如何在 setongoing(true) 之后删除持久通知?
how to remove a persistent notification after setongoing(true)?
这是我用来在 Android 中创建通知的代码。此通知按预期显示,不会通过滑动通知来删除。
但我无法以编程方式删除它。我应该如何删除它?
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(getApplicationContext(), Constants.CHANNEL_ID)
.setSmallIcon(R.drawable.small)
.setContentTitle("persistent")
.setContentText("cant remove").setOngoing(true);
mBuilder.build();
这是我用来在 Android 中创建通知的代码。此通知按预期显示,不会通过滑动通知来删除。 但我无法以编程方式删除它。我应该如何删除它?
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(getApplicationContext(), Constants.CHANNEL_ID)
.setSmallIcon(R.drawable.small)
.setContentTitle("persistent")
.setContentText("cant remove").setOngoing(true);
mBuilder.build();