0

Currently I am working on notification. But when I already receive notification and I have clicked on this notification on notification bar, I have not to open new activity. But I have to open recent activity. When some data have saved in my recently app and app running in the background and receive notification then using pending intent activity start with onresume/oncrete. But my last activity saved data has been lost. So any solution when click on notification then I have not to restart activity.

Please give me some solution.

Thanks in advance.

Hemang
  • 26,840
  • 19
  • 119
  • 186
dipali
  • 10,966
  • 5
  • 25
  • 51

1 Answers1

0

I got solution.

Add Flag in pending intent to clear top /recent activities from Stack,.

notificationIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);

dipali
  • 10,966
  • 5
  • 25
  • 51
  • _+1_ here is the best solution http://stackoverflow.com/questions/31448840/android-how-to-open-last-activity-when-tapping-notification – nAkhmedov Jul 22 '15 at 11:00