You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
TermApp/app/src/main/java/com/xypower/mpapp/BootBroadcastReceiver.java

47 lines
1.5 KiB
Java

package com.xypower.mpapp;
2 years ago
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
2 years ago
import android.util.Log;
public class BootBroadcastReceiver extends BroadcastReceiver {
private static final String ACTION = "android.intent.action.BOOT_COMPLETED";
@Override
public void onReceive(Context context, Intent intent) {
Log.i("BootBroadcastReceiver", intent.getAction());
if (ACTION.equals(intent.getAction())) {
2 years ago
/*
Intent mainIntent = new Intent(context, MainActivity.class);
mainIntent.putExtra("reboot", 1);
2 years ago
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
try {
pendingIntent.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
*/
2 years ago
MainActivity.AppConfig appConfig = MainActivity.getAppConfig(context);
MainActivity.startMicroPhotoService(context, appConfig);
/*
2 years ago
Intent mainIntent = new Intent(context, MainActivity.class);
mainIntent.putExtra("reboot", 1);
//Intent.FLAG_ACTIVITY_NEW_TASK
// Intent.FLAG_ACTIVITY_CLEAR_TOP
mainIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(mainIntent);
*/
}
}
}