Android Status Bar Notifications - Opening the correct activity when selecting a notification?

May have actually answered my own question.

Up vote 2 down vote favorite 3 share g+ share fb share tw.

I have been having a problem with a notification not opening/going to the correct activity when it has been clicked. My notification code (located in a class which extends Service): Context context = getApplicationContext(); CharSequence contentTitle = "Notification"; CharSequence contentText = "New Notification"; final Notification notifyDetails = new Notification(R.drawable. Icon, "Consider yourself notified", System.

CurrentTimeMillis()); Intent notifyIntent = new Intent(context, MainActivity. Class); PendingIntent intent = PendingIntent. GetActivity(context, 0, notifyIntent, PendingIntent.

FLAG_UPDATE_CURRENT | Notification. FLAG_AUTO_CANCEL); notifyDetails. SetLatestEventInfo(context, contentTitle, contentText, intent); ((NotificationManager)getSystemService(NOTIFICATION_SERVICE)).

Notify(NOTIFICATION_ID, notifyDetails); If I click the notification while the application which created the service is open, the notification disappears (due to the FLAG_AUTO_CANCEL) but the activity does not switch. If I click the notification from the home screen, the notification disappears and my app is brought to the front, however it remains on the activity which was open before going to the home screen, instead of going to the main screen. What am I doing wrong?

How do I specify the activity that will be pulled up? Android activity notifications link|improve this question asked May 26 '10 at 21:45Mr Zorn13818.

May have actually answered my own question: Intent notifyIntent = new Intent(Intent. ACTION_MAIN); notifyIntent. SetClass(getApplicationContext(), Main.

Class).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions