Programmatically disables the default application

I made the Home application, and I would like to offer the opportunity to exit it and disable it as the default application.

Exiting is easy (just start the intention), but the problem is that I don’t want my program to start again the next time the user clicks the Home button.

I know that this can be done by going to Settings / Applications / my applications / to erase the default actions, but I would like to do this from my program so that the user cannot search for this function.

How can I do that?

+7
android
source share
1 answer

You can use the PackageManager to clear yourself of the default activity, you cannot clear other actions. This answer may help: How to use PackageManager.addPreferredActivity ()?

+5
source share

All Articles