0

I want to save default action chosen by user on clicking checkbox after launching available applications using ResolverActivity.java. I have gone through ResolverActivity.java, below chunk of code does get execute but still the default action is not saved. And next time i need to choose action/application all over again.

Code :

getPackageManager().addPreferredActivity(filter, bestMatch, set,
                     intent.getComponent());

Can anybody tell me whats the reason behind this code not working.

4

2 回答 2

2

Third party apps cannot control the default apps for any action due to security reasons. Only the system may alter these settings.

于 2013-04-10T12:07:11.507 回答
0

Android security policy will prohibit you from changing preferred activities, except that if your activity has been set as default you may unset that default.

If you just need a default for your own app, you'll have to write all the code to handle this yourself. Create your own dialog with a list of options to choose from, your own checkbox to remember the setting, your own code to save & load that default, etc.

于 2013-04-10T12:10:12.087 回答