clear application defaults

与世无争的帅哥 提交于 2019-12-12 08:14:52

问题


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.


回答1:


I think that clearPackagePreferredActivities() on PackageManager will do this for you.




回答2:


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



来源:https://stackoverflow.com/questions/6761553/clear-application-defaults

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!