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
  • 7,993
  • 106
  • 33
  • 46
Divya SIngh
  • 119
  • 1
  • 10

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
  • 495
  • 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,589
  • 1
  • 18
  • 21
0

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

mr.icetea
  • 2,547
  • 2
  • 23
  • 41