Android: Make Your Notification even Sticky-er

In my previous post, I’ve expanded things to make a notification sticky. This worked in my tests until yesterday, when I’ve found a new case where my notification would go away:



  • Build an sticky notification as per the two previous posts
  • Activate the notification – this will trigger the activity to be displayed on screen. The notification will remain shown
  • Activate the notification again – this will make the notification go away, because the activity is already on screen
  • <


    I’ve tried triggering the notification in onCreate() , onStart(), onPostCreate(), onResume() without any effect.

    However, with the help of this answered question, I’ve managed to re-trigger the notification. The only interesting method that gets called when the activity is already on top is onNewIntent(). My activity code looks like this now:

    You can probably trigger the notification directly via run() , but the most common method I’ve seen online is via a call.

    A little experiment: If you find this post and ad below useful, please check the ad out :-)

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Scroll to top