1

I have developed parse push notification in my app.

What I want now push notification should clear automatically from notification bar without any click on it after 10 min.Is it possible?

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
Divya SIngh
  • 129
  • 1
  • 11

3 Answers3

2

May be this will do the trick please do the required changes

Handler handler = new Handler();
    handler.postDelayed(new Runnable() {
        @Override
        public void run() {
              String ns = Context.NOTIFICATION_SERVICE;
            NotificationManager nMgr = (NotificationManager) getApplicationContext().getSystemService(ns);
            nMgr.cancel(NOTIF_ID);
        }
    }, 600000);
Akash Jindal
  • 505
  • 3
  • 7
2

Sure, implement any handler that will wait, and after it remove your notification.

Here is description how to remove notification.

Community
  • 1
  • 1
Artur Szymański
  • 1,639
  • 1
  • 19
  • 22
0

Yes it is possible. Use Handler's postDelay to trigger Notification cancel after 10 min.

mr.icetea
  • 2,607
  • 3
  • 24
  • 42