Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 589
newdev Avatar asked Jul 20 '11 12:07

newdev


People also ask

What does it mean to clear defaults?

Tap CLEAR DEFAULTS to clear out the default actions that you set. If the app is set as the default for some actions, you'll see You've chosen to launch this app by default and a CLEAR DEFAULTS option. If the app is not set as the default, you'll see No defaults set, and the CLEAR DEFAULTS option will be grayed out.

What happens when reset apps default?

For starters, resetting will clear all the default apps. For instance, when you download a third-party gallery app, if you open a photo via file explorer, your phone will ask you to choose a default app. You'll be provided with two options – Once and Always.

What do default applications mean?

A default app is the one you'd like your operating system to use to open certain files or links. Understandably, out of the box, Android defaults to Google applications. For instance, the default web browser for Android is Chrome.


1 Answers

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

like image 158
CommonsWare Avatar answered Oct 11 '22 20:10

CommonsWare