26 lines
731 B
Java
Raw Normal View History

2017-01-29 16:52:43 +08:00
package com.topjohnwu.magisk.receivers;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
2017-07-01 17:55:43 +08:00
import android.os.Build;
2017-01-29 16:52:43 +08:00
2017-07-01 17:55:43 +08:00
import com.topjohnwu.magisk.services.OnBootIntentService;
2017-01-29 16:52:43 +08:00
public class BootReceiver extends BroadcastReceiver {
2017-02-05 22:02:14 +08:00
2017-07-01 17:55:43 +08:00
private void startIntentService(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(new Intent(context, OnBootIntentService.class));
} else {
context.startService(new Intent(context, OnBootIntentService.class));
}
}
2017-01-29 16:52:43 +08:00
@Override
public void onReceive(Context context, Intent intent) {
2017-11-15 04:39:05 +08:00
startIntentService(context);
2017-02-07 06:02:06 +08:00
}
2017-01-29 16:52:43 +08:00
}