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
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 PackageManager
will clear the defaults of a particular app, whichever's package name you pass.
PreferenceManager.getDefaultSharedPreferences(context).edit().clear().commit();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With