|
|
@@ -43,10 +43,15 @@ public class DaemonService extends Service { |
|
|
|
@Override
|
|
|
|
public void onCreate() {
|
|
|
|
super.onCreate();
|
|
|
|
log("created");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
|
|
|
log("started");
|
|
|
|
|
|
|
|
//利用 Android 漏洞提高进程优先级, 前台进程
|
|
|
|
String CHANNEL_ONE_ID = "CHANNEL_ONE_ID";
|
|
|
|
String CHANNEL_ONE_NAME= "CHANNEL_ONE_ID";
|
|
|
|
String CHANNEL_ONE_ID = "DaemonService";
|
|
|
|
String CHANNEL_ONE_NAME= "DaemonService";
|
|
|
|
NotificationChannel notificationChannel= null;
|
|
|
|
//进行8.0的判断
|
|
|
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
|
|
@@ -64,11 +69,6 @@ public class DaemonService extends Service { |
|
|
|
notification.flags|= Notification.FLAG_NO_CLEAR;
|
|
|
|
|
|
|
|
startForeground(CORE_SERVICE_ID, notification);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
|
|
|
log("started");
|
|
|
|
executorService.submit(new Runnable() {
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|