Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to click on Android Button then go to google play apps

Tags:

android

I wonder how to make a android button can click and redirect user to google play.

Example: I want send user to android apps(https://play.google.com/store/apps/details?id=com.theopen.android) after user click on Button in my activity.

How to do this?

Regards,

like image 476
SopheakVirak Avatar asked Jul 23 '12 09:07

SopheakVirak


2 Answers

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

This will open your application in Play store(android market)

like image 80
MAC Avatar answered Sep 23 '22 14:09

MAC


To redirect to google play, we need to check whether the mobile already have play store app, if not google play should be opened in browser.

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.android.app"));
try{
     startActivity(intent);
}
catch(Exception e){                 intent.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.android.app"));
            }
like image 43
Nithin Raja Avatar answered Sep 21 '22 14:09

Nithin Raja