I found that I am using a deprecated method for noficitations (notification.setLatestEventInfo())
It says to use Notification.Builder.
- How do I use it?
When I try to create a new instance, it tells me:
Notification.Builder cannot be resolved to a type
In case it helps anyone... I was having a lot of trouble with setting up notifications using the support package when testing against newer an older API's. I was able to get them to work on the newer device but would get an error testing on the old device. What finally got it working for me was to delete all the imports related to the notification functions. In particular the NotificationCompat and the TaskStackBuilder. It seems that while setting up my code in the beginning the imports where added from the newer build and not from the support package. Then when I wanted to implement these items later in eclipse, I wasn't prompted to import them again. Hope that makes sense, and that it helps someone else out :)
Notification Builder is strictly for Android API Level 11 and above (Android 3.0 and up).
Hence, if you are not targeting Honeycomb tablets, you should not be using the Notification Builder but rather follow older notification creation methods like the following example.
I have used
I was having a problem building notifications (only developing for Android 4.0+). This link showed me exactly what I was doing wrong and says the following:
Basically I was missing one of these. Just as a basis for troubleshooting with this, make sure you have all of these at the very least. Hopefully this will save someone else a headache.
Self-contained example
Same technique as in this answer but:
Source:
Tested in Android 22.