Ok so I changed my intent to using my LAUNCHER (main start up) activity and it launches that activity but when the last activity is something different, it doesn't restore/launch that one.
On Jan 25, 12:50 pm, Wall-E <[email protected]> wrote: > I have created a notification when receiving an SMS and I would like > my application to either launch OR if it has already been launched to > return to the last activity the user left it. I tried reading up on > Activities and Tasks and the flags associated with it but it did not > help me much. I tried the code described below but it doesn't do > anything when clicking on notification. > > Currently I have set the launchMode to singleTask but am not sure if > that is what I want to reach the desired behavior mentioned above, can > anybody clarify? > > Also, creating the intent to pass into the PendingIntent is confusing > me too. This is what I have so far: > > Context context = getApplicationContext(); > > Intent openMyAppIntent = new Intent(context, MyApplication.class); > showNotification(openMyAppIntent, "SMS Encounter", "Received SMS", > msg, R.drawable.icon); > > this is showNotification: > > private void showNotification(Intent intent, String message, String > messageHeadline, String messageDetails, int icon) > { > NotificationManager mNotificationManager = > (NotificationManager)getSystemService(NOTIFICATION_SERVICE); > > Notification notifyDetails = new Notification(icon, message, > System.currentTimeMillis()); > > PendingIntent myIntent = > PendingIntent.getActivity(getApplicationContext(), 0, intent, 0); > > notifyDetails.setLatestEventInfo(getApplicationContext(), > messageHeadline, messageDetails, myIntent); > notifyDetails.flags |= Notification.FLAG_AUTO_CANCEL; > > mNotificationManager.notify(ID, notifyDetails); > > > > > > > > } -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

