Does anyone know exactly what happens when the "set as default for this action" check box is clicked in the "Complete action using" dialog box. I assume there is a flag set somewhere and I was just trying to figure out where that flag was and if I can set and clear it in code so the dialog box does not keep popping up.
1 Answers
See the answer to Custom filtering of intent chooser based on installed Android package name: this points at the source code for ChooserActivity and ResolverActivity.
Looking in ResolverActivity (see line 197) there is this chunk of code:
getPackageManager().addPreferredActivity(filter, bestMatch, set,
intent.getComponent());
Apparently this lets you tell the package manager what the preferred activity for a specified IntentFilter is. The function onIntentSelected
builds up all those variables so you'll need to go running through that function to figure out the best way to make that work for you.
I'm not certain you'll be able to set it globally though: my expectation is that the only way to set that value is from within the chooser package, and since your code won't be running with the privileges of that package I don't think you'll be able to change it.