android 開機啟動
阿新 • • 發佈:2019-02-08
package com.yifenqi.receiver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import com.yifenqi.activity.LoginActivity; import com.yifenqi.util.Log; public class BootBroadcastReceiver extends BroadcastReceiver { static final String action_boot = "android.intent.action.BOOT_COMPLETED"; @Override public void onReceive(Context context, Intent intent) { Log.d(getClass(), ""+action_boot); if (intent.getAction().equals(action_boot)) { Intent ootStartIntent = new Intent(context, LoginActivity.class); ootStartIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(ootStartIntent); } } }