Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to link to android app with Google Play Store

I have a free version of app and i want to link the app store on click of the buy button on the app. How to i do this, i have completely no idea and please help me with some code.
Thanks in advance

What I did was

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    buyButton = (Button)findViewById(R.id.buybutton);

    buyButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse("market://details?id=app name"));
        }
    }
}
like image 533
learner Avatar asked Dec 07 '22 19:12

learner


2 Answers

Use this code to redirect user to the market:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=your.game.package.name"));
startActivity(intent);

Hope this helps.

like image 115
Egor Avatar answered Dec 22 '22 01:12

Egor


use below code

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

refer this link

http://developer.android.com/guide/publishing/publishing.html

like image 38
ilango j Avatar answered Dec 22 '22 00:12

ilango j