has Google Play - Android android.content

Android examples for android.content:Intent

Description

has Google Play

Demo Code

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import java.util.List;

public class Main{

    public static boolean hasGooglePlay(Context context) {
        Uri uri = Uri/*  w  ww.  j ava2s  . co m*/
                .parse("http://play.google.com/store/apps/details?id=com.google.android.gms");
        Intent mapCall = new Intent(Intent.ACTION_VIEW, uri);
        mapCall.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
        mapCall.setPackage("com.android.vending");
        PackageManager packageManager = context.getPackageManager();
        List<ResolveInfo> activities = packageManager
                .queryIntentActivities(mapCall, 0);
        return activities.size() > 0;
    }

}

Related Tutorials