Opens Google Play Services in Google Play, if available. - Android App

Android examples for App:App Market

Description

Opens Google Play Services in Google Play, if available.

Demo Code


//package com.java2s;

import android.content.ActivityNotFoundException;
import android.content.Context;

import android.content.Intent;

import android.net.Uri;

import android.widget.Toast;

public class Main {
    /** Opens Google Play Services in Google Play, if available. */
    public static void openGooglePlayServicesInGooglePlay(
            final Context context) {
        Uri uri = Uri.parse("market://details?id=com.google.android.gms");
        Intent myAppLinkToMarket = new Intent(Intent.ACTION_VIEW, uri);
        try {/*from   w w  w . j  a  v  a2 s .  com*/
            context.startActivity(myAppLinkToMarket);
        } catch (ActivityNotFoundException e) {
            Toast.makeText(context, "Unable to find app in Google Play",
                    Toast.LENGTH_SHORT).show();
        }
    }
}

Related Tutorials