6

It is known that we can send the intent as described in the following link and then it redirects user to Google Play.

Uri marketUri = Uri.parse("market://details?id=" + packageName);
Intent marketIntent = new Intent(Intent.ACTION_VIEW, marketUri);
startActivity(marketIntent);

But the problem is that all app store, especially Amazon App Store (in Kindle), can handle this intent as well?
I know that the following URI must redirect user to amazon app store:

http://www.amazon.com/gp/mas/dl/android?p=package

But, I don't want to have two binaries, one for ordinary Android and the other for Amazon.

Bear
  • 5,138
  • 5
  • 50
  • 80
  • Couldn't you detect the device and use either URL depending on the device? – Anirudh Ramanathan Jun 25 '12 at 09:32
  • Yes, but I think it is not a good solution. Actually, there are not only Google Play and Amazon App Store, there are many App store in China Android Phone/Tablet. And I can't handle all devices... Btw, I know that I can get the manufacturer but I don't know the exact string returned from an amazon devices as I don't have a device in hand – Bear Jun 25 '12 at 09:38
  • 2
    Way to find device -> http://stackoverflow.com/questions/8309624/detect-app-is-running-on-kindle-fire – Anirudh Ramanathan Jun 25 '12 at 09:41
  • 1
    Amazon app store can be installed on all devices, not just the Kindle. Detecting by device isn't good enough, you have to put in your app some flag that will notify where the app came from. – Ran Jun 25 '12 at 09:42
  • 1
    It is ok to redirect user to google play if there is Google Play even though Amazon app store exists too – Bear Jun 25 '12 at 09:43
  • @DarkXphenomenon Thx, but I am still waiting for a more generic method – Bear Jun 25 '12 at 09:44
  • Actually, is there anyone have a kindle here? Please try the code above and tell us the result? Thank – Bear Jun 25 '12 at 09:49

1 Answers1

3

There is no generic method, the thing to do here is set a bunch of flags in your code.

so you would have something like

boolean AMAZON_APK=true;
boolean ANDROID_APK =false;
....

Then you would set the appropriate values when you want to publish to amazon and when you want to publish to Android Play. In your code before launching the market you would check the flags with a bunch of if statements and launch the appropriate intent depending on what the particular market supports. This is not a huge deal since you only have to change a few variables.

if(AMAZON_APK)
  //launch amazon intent
if(ANDROID_APK)
  //launch android market intent
....

You can see a more complete example here. How can I do an Amazon App Store search using an Intent and filter it by developer name? also if some markets don't support anything like a market intent you can launch a link to a mobile website and point the user to your apps from there.

Community
  • 1
  • 1
mbwasi
  • 3,612
  • 3
  • 30
  • 36
  • As I mention before, I don't want to have two separate binaries. What I want to know is that does amazon devices can recognize the intent I mentioned above. I know that it is banned from amazon app store, but I don't care as I don't plan to upload to their app store. I just want to make sure it works if it really in Amazon device – Bear Jun 25 '12 at 14:13
  • Right, while I cant confirm what kindle does with the market intent, a way to do this without having to release separate binaries is to use PackageManager to see if Play store is installed and then launch the android intent, if not check if Amazon is installed, if both are not there then use the website or any other "store" apps that you know of. See this on using the package manager to check for installed apps http://stackoverflow.com/q/6711295/329034 – mbwasi Jun 26 '12 at 08:39