Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I am using the URI format http://play.google.com/store/apps/details?id=<package_name> described in Linking to Your Apps on Google Play in order to open the app in Android Market or Google Play to install it. But it only opens it in the browser as it would do it on the desktop. And when Install is clicked it asks the user to sign-in to install.

How can I link the app in Google Play so the user can install it?

share|improve this question
    
This is weird, since on my device the browser straight up refuses to open Market links and opens the Market app. I would go to Settings -> Applications -> Manage applications and clear the defaults for the browser to ensure that isn't causing the problem. If that doesn't work: What device do you have? Have you tried typing the URL directly into the browser and seeing what happens? Where is this link appearing, exactly? (On a web page or in another app?) –  Matthew Read Apr 23 '12 at 22:46
    
@MatthewRead I've tried to used the link from a message, QR code, email,... And same thing. Also, I've tried on different android devices, not just one, and same issue. –  slybloty Apr 23 '12 at 23:26
    
Try replacing http with https. It may look dumb, but try it. –  Sachin Shekhar Apr 24 '12 at 13:25
    
@SachinShekhar I used both http and https. Even market. And the same result. –  slybloty Apr 24 '12 at 13:37
    
What's your web browser? Default Android browser and Dolphin HD automatically redirect to Play Store app (or, atleast ask)... –  Sachin Shekhar Apr 24 '12 at 13:43
add comment

5 Answers

up vote 6 down vote accepted

Try directly this if link is originated from an app for Android to handle:

market://details?id=<package_name>

Notice: There's no domain and host.

share|improve this answer
    
Interesting that this way works. It directs to the market place properly. Thanks. –  slybloty Apr 24 '12 at 14:36
1  
This'll only work on the Android device. Trying this in a desktop browser won't work. –  Al E. Apr 24 '12 at 15:20
    
@AlEverett Unless there's a market protocol handler in desktop browser to insert domain and host. :) –  Sachin Shekhar Apr 24 '12 at 15:24
    
In fact, it doesn't work even in Android web browsers. Its intended to use in app development. –  Sachin Shekhar Apr 24 '12 at 15:26
    
Then if this is an app development question it's in the wrong place. –  Al E. Apr 24 '12 at 15:30
show 5 more comments

I'm using the code below and it is working fine with my phone and emulator.

For the phone with Google Play app, it will automatically open the app. For the emulator (without Google Play app), it will automatically open the browser.

try { 
  Intent intent = new Intent(Intent.ACTION_VIEW);
  intent.setData(Uri.parse("market://details?id=com.example"));
  startActivity(intent);
} catch (Exception e) { //google play app is not installed
  Intent intent = new Intent(Intent.ACTION_VIEW);
  intent.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.example"));
  startActivity(intent);
}
share|improve this answer
    
+1 for try/catch. In fact sometimes if there is no Google Play app installed on device, we'll get crash when try to open an app with URL starts with "market://details?id=" –  anticafe Jan 4 '13 at 8:24
add comment

First off, the user can actually install the app from the market. He just can't do it directly but only make Google remote-install the app via the website, as he would do if he browsed the market on his PC.

Second, what browser are you testing this with? Opera isn't well integrated into Android and won't open Play URLs in the app. In fact I'm not sure even the native browser will.

Maybe you should just use market:// links instead of http://links.

share|improve this answer
    
It's the android browser it opens with instead of the app. The link is accessed from the device. I want the user to be able to install the app by clicking the link and be directed to Market or Google Play. –  slybloty Apr 23 '12 at 22:37
add comment

Settings > Applications > All (top tab)
Click Menu button > Reset app preferences

Source: http://www.youtube.com/watch?v=zt_alKha_-s

share|improve this answer
add comment

I found simple and easy solution.

  1. make a html page any where. <meta http-equiv="REFRESH" content="0; URL=market://details?id=package_name" />
  2. Open browser and type this html URL
  3. you will see your app in play market app
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.