How to remove the notification after the particular time in android?

后端 未结 5 1973
余生分开走
余生分开走 2021-01-05 00:19

I am creating an simple android application in that created a notification.

Now i want to remove the notification if the user doesn\'t response after the particular

5条回答
  •  心在旅途
    2021-01-05 00:51

     NotificationCompat.Builder notification = new NotificationCompat.Builder(context)
                    .setSmallIcon(Util.getNotificationIcon(context))
                    .setContentTitle(new SessionManager().getDomainPreference(context))
                    .setAutoCancel(true)
                    .setOngoing(false)
                    .setPriority(NotificationCompat.PRIORITY_MAX)
                    .setShowWhen(false)
                    .setContentText(summaryText)
                    .setTimeoutAfter(3000) // add time in milliseconds
                    .setChannelId(CHANNEL_ID);
    

提交回复
热议问题