开发者

android api auto startup activity after shutdown and restart

开发者 https://www.devze.com 2023-03-17 03:48 出处:网络
i have following problem: i write broadcastReceiver that receive android.intent.action.BOOT_COMPLETED all work fine if i do restart from power options or remove battery, but if i use POWER OFF - powe

i have following problem:

i write broadcastReceiver that receive android.intent.action.BOOT_COMPLETED all work fine if i do restart from power options or remove battery, but if i use POWER OFF - power option system did't go thrue BOOT_COMPLETED intent. Please help what kind of intent i must receive to get this to cases for auto startup activity on android phone.

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<receiver android:name=".StartupBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" 开发者_C百科/>
</intent-filter>
</receiver>


In your Broadcast Receiver class, Check :

getIntent().getAction().equalsIgnoreCase("android.intent.action.BOOT_COMPLETED") { // call startActivity(intent); }

It will definitely help you.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号