hi All,
I'm trying to use Notification manager and Pending Intent so that whenever
the user clicks the notification the currently running activity's UI is
shown. However in the code I'm using, as shown below opens up a new
instance of the app instead of leading the user to the currently running
one:

---code snippet----
mNotificationManager = (NotificationManager)
getSystemService(NOTIFICATION_SERVICE);
// //Add current song to notification bar
 CharSequence tickerText = "Demo Alert";
long when = System.currentTimeMillis();
 CharSequence contentTitle = "Now playing";
CharSequence contentText = "Demo song";
 PendingIntent pendingIntent = PendingIntent.getActivity(
getApplicationContext(), 0, new Intent(this,
 DemoPendingIntentActivity.class), 0);

Notification notification = new Notification(
 R.drawable.ic_stat_playing, tickerText, when);
notification.setLatestEventInfo(getApplicationContext(), contentTitle,
 contentText, pendingIntent);
notification.contentIntent = pendingIntent;
 // Make the notification non-clearable
notification.flags = Notification.FLAG_ONGOING_EVENT;
 mNotificationManager.notify(notificationId, notification);
---code snippet----

How do I open up the currently running activity instead of opening a new
one? Please let me know whats going wrong in the above code. Appreciate
your time.

Thanks,
KK

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to