1.对于服务可以设置为前景服务,在onCreate方法中
Notification notification=new Notification();
startForeground(id, notification);
2.对于接收器可以在主文件中注册
1.对于服务可以设置为前景服务,在onCreate方法中
Notification notification=new Notification();
startForeground(id, notification);
2.对于接收器可以在主文件中注册