问题
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