Michael Levy
Michael Levy

Reputation: 13297

Can I set the Android "use by default" programmatically for an activity?

I want an activity to launch when a user touches a special URL embedded in an SMS message. I have an activity with an intent filter that matches my unique scheme, host, and pathPrefix. Of course the first time the user touches a link to my trigger url they are presented with the "Complete action using" selection that includes my application and any web browser the user has installed.

Is there a way I can programmatically set the "use by default" setting so my activity is the default action?

(I know this smells like I'd be taking away control from the user so I doubt it is possible, but I figured it wouldn't hurt to ask).

Upvotes: 0

Views: 1612

Answers (2)

Maciej Boguta
Maciej Boguta

Reputation: 1374

it is possible as long as your app is signed with platform key, if so, just use ChooserActivity class from com.android.internal.app

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1007644

Is there a way I can programmatically set the "use by default" setting so my activity is the default action?

No, sorry.

I know this smells like I'd be taking away control from the user so I doubt it is possible

You have an exquisite olfactory sense... :-)

Upvotes: 3

Related Questions