"does 'MyApplication.class' refer to your main activity, or to your application class?"
The MyApplication.class refers to my application class. My app has multiple activities so which activity do I use because I want it to load or restore whichever activity the user left. "Have you set up a broadcast receiver to monitor for an incoming sms in your manifest?" Yes I have. I am receiving SMS messages just fine and I'm also getting the notification so I'm not sure what your question has to do with my problem. Does it have to do with what context I'm using inside the intents? If so, what I'm doing is starting a serviceIntent which is basically just an SMS parser and inside the SMS parser is where I'm handling the notification stuff. On Jan 25, 1:36 pm, "Tommy" <[email protected]> wrote: > Have you set up a broadcast receiver to monitor for an incoming sms in your > manifest? > > > > > > > > -----Original Message----- > From: [email protected] > > [mailto:[email protected]] On Behalf Of Wall-E > Sent: Tuesday, January 25, 2011 12:50 PM > To: Android Developers > Subject: [android-developers] notification help > > 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 > athttp://groups.google.com/group/android-developers?hl=en -- 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

