Android 设备启动时,APP应用自启动
生活随笔
收集整理的這篇文章主要介紹了
Android 设备启动时,APP应用自启动
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?添加一個開機監聽即可
<!--開機廣播權限--> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> public class BootReceiver extends BroadcastReceiver {@Overridepublic void onReceive(Context context, Intent intent) {if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {Intent bootStartIntent = new Intent(context, MainActivity.class);bootStartIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);context.startActivity(bootStartIntent);}} } <receiverandroid:name="com.dlc.guangxixinkangda.broadcast.BootReceiver"android:enabled="true"android:exported="true"><intent-filter android:priority="1000"><action android:name="android.intent.action.BOOT_COMPLETED" /><category android:name="android.intent.category.HOME" /></intent-filter> </receiver>?
?
總結
以上是生活随笔為你收集整理的Android 设备启动时,APP应用自启动的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 安装Oracle数据库操作步骤
- 下一篇: Android 屏幕灭屏亮屏广播,屏幕灭