大家好
我希望点击使用下面的代码取消通知,但有些原因它总是在通知区域的正在进行的部分显示通知,但也无法清除..
NOTIFICATION_ID = NOTIFICATION_ID + 1;
Intent intent1 = new Intent(this, MyClass.class);
PendingIntent pii = PendingIntent.getActivity(this, 1, intent1, 0);
Notification notification1 = new Notification(R.drawable.icon, "test",
System.currentTimeMillis());
notification1.setLatestEventInfo(this,
"test", "test", pii);
notification1.flags |= Notification.FLAG_AUTO_CANCEL;
startForeground(NOTIFICATION_ID, notification1);
Run Code Online (Sandbox Code Playgroud)
谢谢