Home » Android » Android – How to create a Permanent Notification

Android – How to create a Permanent Notification

Posted by: admin June 15, 2020 Leave a comment


I have created a notification in my “onCreate” activity method.

Everything runs smoothly, only that you can close it by pressing the “delete all” button.

How do I make this notification perma? as in it should just be more of an info rather than a notification..

This is my current code:

    private void showNotification() {
    // TODO Auto-generated method stub
    nMN = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    Notification n  = new Notification.Builder(this)
    .setContentTitle("Whip And Weep")
    .setContentText("Whip is On!")
    nMN.notify(NOTIFICATION_ID, n);
How to&Answers:

On your notification builder use .setOngoing(true). This will prevent the user from removing your notification.

See the Notification Builder Documentation for more info:


ok add this in your code :

n.flags |= Notification.FLAG_NO_CLEAR;