Question

If I have a free version of a paid app in the Android market how can I place a button in the free app that opens the paid version in the market?

Was it helpful?

Solution

Add this to the button's OnClickListener's onClick method:

Intent marketLaunch = new Intent(Intent.ACTION_VIEW);
marketLaunch.setData(Uri.parse("market://search?q=uk.co.ashtonbrsc"));
startActivity(marketLaunch);

Replacing uk.co.ashtonbrsc with a search term that will find your app.

OTHER TIPS

Even better to use "market://details" instead of "market://search":

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

Then it opens directly the details page of the app. With search it shows a single search result and the user has to do an additional click to get to the detail page.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top