[android-developers] Re: Intent always restarts activity, even if already running...
OK, got it. Just needed the right notification flags... Thought it had to do with the intent! Sheesh!
On Saturday, March 17, 2012 3:24:19 PM UTC-4, RedBullet wrote:
So, I am creating a notification which, when selected, I would like to make my app the active app. But what it is doing instead is re-starting the app even though I know it is still running.--Here is how I create the notification, I suspect I need to be more clever with the Intent:private void createNotification(){NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); Notification notification = new Notification(R.drawable.icon,"A new notification", System.currentTimeMillis());// Hide the notification after its selectednotification.flags |= Notification.FLAG_AUTO_CANCEL;Intent intent = new Intent(this, RideRoutingActivity.class);PendingIntent activity = PendingIntent.getActivity(this, 0, intent, 0); notification.setLatestEventInfo(this, "This is the title", "This is the text", activity);notification.number += 1;notificationManager.notify(0, notification);}
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home