Android开机自启动
1. 在Manifest.xml文件中 添加如下的权限:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission>
2.在Manifest.xml中,添加receiver的声明:
<receiver android:name="<my app package>.BootReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </receiver>
3.编写BootReceiver类,在其onReceive中添加相应的处理逻辑