I am working with notifications for the first time, and it seems that i must be missing something obvious. I have an Android app that plays music. While it is playing, I have an ongoing notification displayed so I can easily get back to my app if it is in the background. My problem is that when I click the notification, it opens a whole new instance of the application, instead of resuming the previous instance.
I have a PendingIntent set up to launch my app, and a call to PendingIntent.getActivity(context, 0,myIntent, 0) I've tried different settings f开发者_如何学Pythonor the last parameter, but same results. What am I missing?
Mark D.
You should edit your Activity's entry in the AndroidManifest.xml
to include android:launchMode
(see here for the options). Most likely will be anything but standard
. Also see if playing around with this and or this may help.
I currently use (in my countdown app):
android:launchMode="singleTask"
精彩评论