在启动时自动启动一个应用程序:

1、AndroidManifest.xml

<receiver android:enabled="true" android:name=".BootUpReceiver"      android:permission="android.permission.RECEIVE_BOOT_COMPLETED">         <intent-filter>           <action android:name="android.intent.action.BOOT_COMPLETED" />           <category android:name="android.intent.category.DEFAULT" />       </intent-filter>   </receiver> 

2、permission

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

3、BroadcastReceiver实现

public class BootUpReceiver extends BroadcastReceiver{         @Override      public void onReceive(Context context, Intent intent) {           Intent i = new Intent(context, MyActivity.class);             i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);           context.startActivity(i);         }     }  

更多相关文章

  1. Android(安卓)hardware so加载流程
  2. 从0到1实现一个Android路由(4)——多模块的APT收集路由
  3. android指纹识别、拼图游戏、仿MIUI长截屏、bilibili最美创意等
  4. 从0到1实现一个Android路由(1)——初探路由
  5. android开发每日汇总【2011-11-26】
  6. 如何使android应用程序使用当前的主题样式
  7. Android:(10)如何安装卸载的应用程序解析
  8. Android(安卓)中启动自己另一个程序的activity如何实现
  9. 【Android】Android(安卓)4.0 无法接收开机广播的问题

随机推荐

  1. No resource found that matches the giv
  2. Android-MemoryFile介绍
  3. android 使用Sax 读取xml
  4. Android(安卓)开发 框架系列 OkHttp使用
  5. 字节跳动面试官:Android源码的Binder权限
  6. Android(安卓)完全退出应用方法
  7. Android的系统服务一览
  8. Android中的SrollView滚动详解
  9. android v13 的新特性
  10. 运行模拟器找不到路径 AVD 更改路径