android 系统启动的时候会发出一个系统启动的广播

ACTION_BOOT_COMPLETED,

它的字符串常量表示为 “android.intent.action.BOOT_COMPLETED”

开机自启动程序,只需要“捕捉”到这个消息再启动你的程序即可,我们要做的是接收这个消息,并实现一个BroadcastReceiver


2、

 广播配置文件

 
 


  权限

 


public class BootBroadcastReceiver extends BroadcastReceiver {
static final String action_boot = "android.intent.action.BOOT_COMPLETED";


@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(action_boot)) {
   Intent ss= new Intent(context, A.class);
   intent.putExtra("boot", "1");
   ss.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
   context.startActivity(bootStartIntent);
}


}

更多相关文章

  1. Android(安卓)蓝牙状态机以及蓝牙启动状态机
  2. 系出名门Android(4) - 活动(Activity), 服务(Service), 广播(...
  3. Android实现系统重新启动
  4. Android常用的技术点
  5. ANDROID模拟器不能启动
  6. cocos2d-x3.0beta版+NDK-r9b在android上的启动过程
  7. Android隐式启动Activity匹配详解:Action,category,data
  8. Android启动优化
  9. android的四大组件及其生命周期

随机推荐

  1. 《Android开发从零开始》――13.Table La
  2. Android官方架构组件DataBinding双向绑定
  3. Android 界面编程
  4. Android 设置颜色的方法总结
  5. Android Studio设置国内镜像网站
  6. Android触摸事件分发机制
  7. Android 系统framework 概述
  8. Android上的Notification
  9. Logger详解(一)
  10. Android Studio镜像设置