Is it possible in android 4.0 and higher to programmatically clear your own app’s defaults? can someone point me in the right direction if possible
Is it possible in android 4.0 and higher to programmatically clear your own app’s
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You cannot set your app as the default for an action programmatically in any version of Android.
This is for security reasons, as a malicious app could exploit this to become the default for any user action, and steal personal information, or render the device useless etc.
At best, on your first run you could launch a chooser intent with dummy data and ask the user to set your app as the default.
EDIT:
My mistake. I thought you wanted to set the defaults.
clearPackagePreferredActivities() in
PackageManagerwill clear the defaults of a particular app, whichever’s package name you pass.