android开机自启动app示例分享
摘要:复制代码代码如下:/*开机自动启动APP*/publicclassBootReceiverextendsBroadcastReceiver{...
复制代码 代码如下:
/*开机自动启动APP*/
public class BootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.d("XRGPS", "BootReceiver.onReceive: " + intent.getAction());
if (ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
Intent mBootIntent = new Intent(context, MainActivity.class);
mBootIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(mBootIntent);
} else {
Log.w("XRGPS", "BootReceiver: unsupported action");
}
}
}
【android开机自启动app示例分享】相关文章:
★ android FM播放时拔出耳机后FM APP自动close解决方法
★ Android 自动化测试经验分享 深入UiScrollable
下一篇:
android计算器代码示例分享