Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//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 {
            context.startActivity(myAppLinkToMarket);
        } catch (ActivityNotFoundException e) {
            Toast.makeText(context, "Unable to find app in Google Play", Toast.LENGTH_SHORT).show();
        }
    }
}