In my app, in an activity(AndroidNotification.java) i am doing the following:
1) i am showing a notification when user press home button.
2) when user click the notification i show the app with the activity - AndroidNotification.java
3) i close the notification on notification bar when my app comes to front(that is in onResume method)
The below code working but the problem is the notification call the activity(AndroidNotification.java) again
my question is i do not want to relaunch the activity , the notification should bring the
activity to front from background, it should not call relaunch.
result of the current behavior is activity is called again so that whole functionality is worked again. that is the problem .
my code:
private NotificationManager mNotificationManager;
Notification notifyDetails;
......
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notifyDetails = new Notification(R.drawable.ic_launcher,
"Notification, Click Me!", System.currentTimeMillis());
Context context = AndroidNotification.this;
CharSequence contentTitle = "Notification Test";
CharSequence contentText = "Get back to Application on clicking me.";
Intent notifyIntent = new Intent(context, AndroidNotification.class);
notifyIntent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT );
PendingIntent intent = PendingIntent.getActivity(
AndroidNotification.this, 0, notifyIntent,0);
// Set properties to notify object - its title, text
notifyDetails.setLatestEventInfo(context, contentTitle,contentText, intent);
// Notify user in status bar
mNotificationManager.notify(SIMPLE_NOTFICATION_ID, notifyDetails);
is anything need to add for the particular activity in AndroidManifest.xml
please help me.