![Android Notification使用及取消 Android Notification使用及取消](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
//发送通知
NotificationManager manger = (NotificationManager) this.getSystemService(NOTIFICATION_SERVICE);
Notification noti = new Notification(R.drawable.icon,"电话录音",System.currentTimeMillis());
Intent it = new Intent();
it.setClass(this, MainActivity.class);//点击通知后要跳向的页面
PendingIntent pi = PendingIntent.getActivity(this, 0, it, 0);
noti.setLatestEventInfo(this, "电话录音", "正在监听...", pi);
noti.defaults = Notification.DEFAULT_ALL;//有4种
manger.notify(, noti);// id=10
//取消
NotificationManager manger = (NotificationManager)this.getSystemService(NOTIFICATION_SERVICE);
manger.cancel();