android - Default App chooser with "always" option -


in 1 of apps want ask user choose web browser, , want options "once" , "always" available them.

right using:

 intent webintent = new intent(intent.action_view);  webintent.setdata(uri.parse("http://www.google.com"));  webintent.setcomponent(new componentname("android","com.android.internal.app.resolveractivity"));  startactivity(webintent); 

and following result:

enter image description here

while allows choose app , has options need, set chrome default, user first have click on chrome, , dialog again set chrome default (it appear in place of firefox).

but want achieve is:

enter image description here

i tried different approaches find on no luck. suggestions appreciated.

as mimmo noted, cannot change behavior of system chooser, , stock android 5.0+ chooser allows user make last-visited app default via "always". also, have no way of setting default app yourself, obvious security reasons.

i recommend rid of setcomponent() call, unlikely work across android devices. device manufacturers can , change things chooser, may involve different classes in different packages.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -