Migrate to JobIntentService to prevent boot notification

This commit is contained in:
topjohnwu
2018-07-21 02:59:36 +08:00
parent 07140d33a7
commit 6263d684d9
7 changed files with 42 additions and 68 deletions
@@ -3,19 +3,16 @@ package com.topjohnwu.magisk.receivers;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.text.TextUtils;
import com.topjohnwu.magisk.services.OnBootIntentService;
import com.topjohnwu.magisk.services.OnBootService;
public class BootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(new Intent(context, OnBootIntentService.class));
} else {
context.startService(new Intent(context, OnBootIntentService.class));
}
if (TextUtils.equals(intent.getAction(), Intent.ACTION_BOOT_COMPLETED))
OnBootService.enqueueWork(context);
}
}