Mark
Mark

Reputation: 3

Resuming Android app from an ongoing notification

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 for the last parameter, but same results. What am I missing?

Mark D.

Upvotes: 0

Views: 471

Answers (2)

hector6872
hector6872

Reputation: 1336

I currently use (in my countdown app):

android:launchMode="singleTask"

Upvotes: 0

Jasoneer
Jasoneer

Reputation: 2078

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.

Upvotes: 2

Related Questions