Yryskul Turduev
Yryskul Turduev

Reputation: 307

How to redirect from button to my play store page?

I want my users able to press "Other Games" button, and redirect them to my developer play store page via Google play app. I did it as following, but it redirected incorrectly.

final String appPackageName2 = "MyCompany%20Name"; // getPackageName() from Context or Activity object
     try {
           activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://developer?id=" + appPackageName2)));
     } catch (android.content.ActivityNotFoundException anfe) {
           activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/developer?id=" + appPackageName2)));
     }

Upvotes: 0

Views: 494

Answers (1)

jojemapa
jojemapa

Reputation: 903

To open the developer page is different, look at an example:

final String developer_id = "my_dev_id";

try {

  activity.startActivity(
    new Intent(
      Intent.ACTION_VIEW, 
      Uri.parse("market://dev?id=" + developer_id)
    )
  );

} catch (android.content.ActivityNotFoundException anfe) {

  activity.startActivity(
    new Intent(
      Intent.ACTION_VIEW, 
      Uri.parse("https://play.google.com/store/dev?id=" + developer_id)
    )
  );

}

To get the information visit your developer page, there you will find all information about your id and other things. Luck.

Docs: Link to Google Play

Upvotes: 1

Related Questions