Android的 - 如何开机启动后/ SD卡的应用程序 [英] Android - How to start an application on the /sdcard after boot
本文介绍了Android的 - 如何开机启动后/ SD卡的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有一个自动开机后一种方式如何启动和Android应用程序,如果它是在 / SD卡
?
Is there a way how to start and android application after a boot automatically if it is on the /sdcard
?
好吧,可能是由的BroadcastReceiver
。但它的行动是正确的?
Ok, probably by BroadcastReceiver
. But which action is the right one?
ACTION_BOOT_COMPLETED - does not work if it is on the /sdcard (documented)
ACTION_MEDIA_MOUNTED - does not work if it is on the /sdcard (which is undocumented)
ACTION_EXTERNAL_APPLICATIONS_AVAILABLE - does not work, I do not know why
ACTION_USER_PRESENT - does not work if the BroadcastReceiver is registered in AndroidManifest (which is undocumented, but documentation bug has been reported)
感谢
扬
Thanks
Jan
推荐答案
请在清单文件中提到它。
Please mention it in manifest file.
</uses-permission>
<receiver android:name=".BootReceiver"
android:enabled="true"
android:exported="true"
android:label="BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"></action>
</intent-filter>
</receiver>
提供许可android.permission.RECEIVE_BOOT_COMPLETED作为menifest的孩子。
provide permission "android.permission.RECEIVE_BOOT_COMPLETED" as child of menifest.
还有一件事你的应用程序不能安装在SD卡。
and one more thing your app must not be installed in sdcard.
这篇关于Android的 - 如何开机启动后/ SD卡的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文