android service随机自启动
很简单,写个Receiver类并继承BroadcastReceiver
然后在onReceive方法做你想做的事情,启动activity或者service都可以。
最后在AndroidManifest.xml中注册一个关键的Receiver配置
<receiver android:name=".XXXXXXReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>