Don't launch app in foreground when clicking on notification in android

I have successfully implemented push notification in android. here are two ways i use it

  • Application closed: Click on the notification, the application will open and do the work necessary.
  • The app is in the foreground: a notification arrives and does the necessary work.

Currently the requirement I do not want to open the app when the user clicks on the notification when the app is closed .

But the second functionality is needed (when the application is in the foreground).

I don't think it is possible, but it needs some experts to look at it :) is it possible?


source to share

1 answer

After some trying, I figured out that this is possible, you just need to pass an empty intent. it's him.



All Articles