I would like to link to Android Marketplace from within my app so I can send my user to write a review. I already know how to link to the Android Marketplace with a WebView, but this doesn't really set the user up to write a review. I need to open up Marketplace on the device and go to purchase/review page for the app.
How to link to Android Marketplace Review from within the app?
Similar to Tim's answer, but this will take the user directly to your app (rather than search results.
You can read more about the Market Intent here.
Uri marketUri = Uri.parse("market://details?id=" + getPackageName());
startActivity(new Intent.ACTION_VIEW).setData(marketUri);
(Note: Assumes your activity is in the same package as declared in your application's manifest. Otherwise, just hardcode your package instead of using getPackageName()
)
Edit: Documentation moved to Linking to Your Products. Thanks Chris Cirefice
Thanks for that link, the getPackageName() is also a new one for me. I had been searching for that section and couldn't find it! For some reason, when I'm running this on my test device with the debugger it gives me the error "Not Found! The requested item could not be found. When I form the web url it works fine so pretty sure that the item is available. Any suggestions? –
Letta
Is your test device set to a different package name? And is that currently published to the market? –
Joannjoanna
Yes, it is published on the market as you can see: market.android.com/details?id=com.laughingplaceapps.harmonize. I hard coded the package name just to be sure and still no go. I tried the package from one of my other apps and same error. I wonder if the debugger blocks the market intent? Or perhaps the market intent isn't working right on my device? –
Letta
Well that doesn't seem to be the problem, I got Tim's search Uri to work for me -- so the package name and device do work. For some reason the details is just not working! –
Letta
Try logging getPackageName() to make sure it's the same as the
manifest package
attribute in your AndroidManifest.xml
–
Joannjoanna Well, it did work when I downloaded it from Market to my phone so you must have been right. Since this does get me to the exact page I wanted -- and you provided the helpful link to documentation -- I'm calling this the answer. Still not sure why it didn't work under the debugger, I'll have to look into that further when I have a spare moment! –
Letta
thanks for marking it as the answer, glad it got you what you were looking for. as for the debugger, not quite sure other than to look at what package it outputs, or maybe if you're using a different singing key. –
Joannjoanna
Different signing key? Yeah, I guess it would be a different signing key wouldn't it! Still learning my way around this. Well, now that I know that it works, I'm not really concerned about getting it to work in the debugger. –
Letta
The link for the Market protocol is now here, but good answer, +1. –
Scotland
Thanks @ChrisCirefice - I updated the answer with the new link –
Joannjoanna
String myUrl = "market://search?q=pname:com.your.package.name";
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(myUrl)) ;
startActivity(i);
This will open up the Market application on the device and show the page for your application(or any app that you give the package name for). As far as I know your user will have to take it from there, I don't think there is anyway to deeplink to the reviews section.
Thanks, although I don't think the code works exactly the way you have put it in. I think you have to call setData(uri) like crackerJack did, am I wrong about that? –
Letta
Well, crackerJack code is giving me an error. With your search uri I'm getting this error: "There are no matches in Android Market for the search: pname:com.laughingplaceapps.harmonize". –
Letta
I did get it to work by removing the "pname:" from the Uri. I would rather do as crackerjack suggested and go straight to the detail page -- but this does work without the pname: so at least I've got something now. –
Letta
This is how I've been doing it:
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=your.package.name")));
© 2022 - 2024 — McMap. All rights reserved.