newdev
newdev

Reputation: 1413

clear application defaults

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.

Upvotes: 5

Views: 2867

Answers (2)

Anil Kashyap
Anil Kashyap

Reputation: 71

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

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1006674

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

Upvotes: 10

Related Questions