Intent to request Google Play - Android Intent

Android examples for Intent:Android Market

Description

Intent to request Google Play

Demo Code


//package com.java2s;
import android.app.Activity;

import android.content.Intent;
import android.net.Uri;

public class Main {
    public static void requestGooglePlay(Activity activity,
            String packageName) {
        try {//www.j a  v a 2  s .c  om
            activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri
                    .parse("market://details?id=" + packageName)));
        } catch (android.content.ActivityNotFoundException anfe) {
            activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri
                    .parse("http://play.google.com/store/apps/details?id="
                            + packageName)));
        }
    }
}

Related Tutorials