haythem souissi
haythem souissi

Reputation: 3273

Force my application to use the market app, when i open my url

i have a button which must lunch download of an application. When i click the button android asked me how to open the link with browser or with market. Can i force it to use the market app so it doesn't prompt?

Here is my code:

String url = "https://play.google.com/store/apps/details?id=org.scid.android";

Intent i = new Intent(Intent.ACTION_VIEW);

i.setData(Uri.parse(url));

startActivity(i);

Upvotes: 0

Views: 397

Answers (2)

CommonsWare
CommonsWare

Reputation: 1006539

Use the market:// URL syntax from the Android developer documentation:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=org.scid.android"));
startActivity(intent);

Upvotes: 2

Kumar Bibek
Kumar Bibek

Reputation: 9117

No you can't, very accurately. You could try and get the Activity names of the Android Market app, but it's not a sure-shot way to do this stuff.

These are implicit intents, and since the data type is a URL, it's obvious that you will be presented with an options dialog.

Upvotes: 0

Related Questions