文章目录
一、 前台 Service 通知问题
二、 设置 startForeground id 参数为 0
三、 启动相同 id 的第二个前台 Service 关闭通知
1、 前台服务 1
2、 关闭通知栏的服务..., 发现该应用就变成了普通后台应用 , 没有进程提权的效果 ;
三、 启动相同 id 的第二个前台 Service 关闭通知
----
不同版本的前台服务策略 :
API Level < 18 :...Notification());
API Level 18 ~ 25 : 直接使用 startForeground(10, new Notification()) 代码启动 , 但是必须启动两个前台服务进程 , 绑定相同的...18 ~ 25 以上的设备 , 启动相同 id 的前台服务 , 并关闭 , 可以关闭通知
startService(new Intent(this, CancelNotificationService.class..., 启动相同 id 的前台服务 , 并关闭 , 可以关闭通知
startService(new Intent(this, CancelNotificationService.class