清除应用程序默认值
我用来
category android:name="android.intent.category.HOME"
category android:name="android.intent.category.DEFAULT"
覆盖 HOME 按钮行为并将其指向我的应用程序。在这个特定的平板电脑上,我只希望运行这个自定义应用程序,并且对于普通用户来说无法退出它(即博物馆展览中的平板电脑)
我有一个隐藏的序列来触发关闭应用程序super.onDestroy(); this.finish(); 但它只是打开备份,因为我已将其设置为我的默认启动器应用程序。我知道如何手动进入“设置”>“应用程序”>“默认启动”>“清除默认值”来重置此设置,但是有没有一种方法可以在我的应用程序中实用地清除默认值?如果您有任何想法,请告诉我。
I am using
category android:name="android.intent.category.HOME"
category android:name="android.intent.category.DEFAULT"
to override the HOME button behavior and point it to my application. On this particular tablet, i only want this custom application to run and for the average user not be able to exit out of it (ie. tablet at a museum exhibit)
I have a hidden sequence to trigger the close of the application super.onDestroy(); this.finish();
but it just opens back up because i have set it to be my default launcher application. I know how to manually go into Settings>Applications>Launch by Default>Clear Defaults to reset this setting, but is there a way that i can clear the defaults pragmatically in my app? If you have any ideas, please let me know.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为
clearPackagePreferredActivities
将为您执行此操作。PackageManager
上的 ()I think that
clearPackagePreferredActivities()
onPackageManager
will do this for you.通过 USB 将您的手机与电脑连接,然后使用命令行永久删除此默认启动器,以便您只能在每个主屏幕上打开主屏幕或主启动器。
adb shell rm /system/app/Launcher2.apk
和
adb shell rm /system/app/Launcher2.odex
Attach your phone with pc via usb then use command line to remove this default launcher permanently so you can open only your home screen or home launcher on each home press.
adb shell rm /system/app/Launcher2.apk
And
adb shell rm /system/app/Launcher2.odex