// Utility method to check for the presence of the Google Play Services APK: public bool IsPlayServicesAvailable() { // These methods are moving to GoogleApiAvailability soon: int resultCode = GooglePlayServicesUtil.IsGooglePlayServicesAvailable(this); if (resultCode != ConnectionResult.Success) { // Google Play Service check failed - display the error to the user: if (GooglePlayServicesUtil.IsUserRecoverableError(resultCode)) { // Give the user a chance to download the APK: msgText.Text = GooglePlayServicesUtil.GetErrorString(resultCode); } else { msgText.Text = "Sorry, this device is not supported"; Finish(); } return(false); } else { msgText.Text = "Google Play Services is available."; return(true); } }
void CheckOldGooglePlayServices(Activity activity) { var isAvailable = GooglePlayServicesUtil.IsGooglePlayServicesAvailable(activity); if (isAvailable != ConnectionResult.Success) { if (GooglePlayServicesUtil.IsUserRecoverableError(isAvailable)) { var dialog = GooglePlayServicesUtil.GetErrorDialog(isAvailable, activity, SIGN_IN_REQUEST_CODE); dialog.Show(); throw new Exception(GooglePlayServicesUtil.GetErrorString(isAvailable)); } else { throw new Exception("This device is not Supported"); } } }
bool IsGooglePlayServicesInstalled() { int queryResult = GooglePlayServicesUtil.IsGooglePlayServicesAvailable(this); if (queryResult == ConnectionResult.Success) { Log.Info("MainActivity", "Google Play Services is installed on this device."); return(true); } if (GooglePlayServicesUtil.IsUserRecoverableError(queryResult)) { string errorString = GooglePlayServicesUtil.GetErrorString(queryResult); Log.Error("ManActivity", "There is a problem with Google Play Services on this device: {0} - {1}", queryResult, errorString); // Show error dialog to let user debug google play services } return(false); }
private bool TestIfGooglePlayServicesIsInstalled() { var queryResult = GooglePlayServicesUtil.IsGooglePlayServicesAvailable(this); if (queryResult == ConnectionResult.Success) { Log.Info("AppCompatAndMaps", "Google Play Services is installed on this device."); return(true); } if (GooglePlayServicesUtil.IsUserRecoverableError(queryResult)) { var errorString = GooglePlayServicesUtil.GetErrorString(queryResult); Log.Error("AppCompatAndMaps", "There is a problem with Google Play Services on this device: {0} - {1}", queryResult, errorString); var errorDialog = GooglePlayServicesUtil.GetErrorDialog(queryResult, this, InstallGooglePlayServicesId); errorDialog.Show(); } return(false); }
private bool TestIfGooglePlayServicesIsInstalled() { int queryResult = GooglePlayServicesUtil.IsGooglePlayServicesAvailable(this); if (queryResult == ConnectionResult.Success) { Log.Info(Tag, "Google Play Services is installed on this device."); return(true); } if (GooglePlayServicesUtil.IsUserRecoverableError(queryResult)) { string errorString = GooglePlayServicesUtil.GetErrorString(queryResult); Log.Error(Tag, "There is a problem with Google Play Services on this device: {0} - {1}", queryResult, errorString); Dialog errorDialog = GooglePlayServicesUtil.GetErrorDialog(queryResult, this, InstallGooglePlayServicesId); ErrorDialogFragment dialogFrag = new ErrorDialogFragment(errorDialog); dialogFrag.Show(FragmentManager, "GooglePlayServicesDialog"); } return(false); }
/// <summary> /// Retourne vrai si les services google play sont disponnible sur le device exécutant l'appli /// </summary> /// <param name="context"></param> /// <returns></returns> public static bool IsPlayServicesAvailable(Context context) { int resultCode = GooglePlayServicesUtil.IsGooglePlayServicesAvailable(context); if (resultCode != ConnectionResult.Success) { if (GooglePlayServicesUtil.IsUserRecoverableError(resultCode)) { Console.WriteLine(GooglePlayServicesUtil.GetErrorString(resultCode)); } else { Console.WriteLine("Sorry, this device is not supported"); } return(false); } else { Console.WriteLine("Google Play Services is available"); return(true); } }
public bool IsPlayServicesAvailable() { int resultCode = GooglePlayServicesUtil.IsGooglePlayServicesAvailable(this); if (resultCode != ConnectionResult.Success) { if (GooglePlayServicesUtil.IsUserRecoverableError(resultCode)) { txtmsg.Text = GooglePlayServicesUtil.GetErrorString(resultCode); } else { Toast.MakeText(this, "Sorry, this device is not supported", ToastLength.Short).Show(); Finish(); } return(false); } else { Toast.MakeText(this, "Google Play Services is available.", ToastLength.Short).Show(); return(true); } }
public bool IsPlayServicesAvailable() { int resultCode = GooglePlayServicesUtil.IsGooglePlayServicesAvailable(this); var left = FindViewById <TextView> (Resource.Id.Left); if (resultCode != ConnectionResult.Success) { if (GooglePlayServicesUtil.IsUserRecoverableError(resultCode)) { left.Text = GooglePlayServicesUtil.GetErrorString(resultCode); } else { left.Text = "Sorry, this device is not supported"; Finish(); } return(false); } else { left.Text = "Google Play Services is available."; return(true); } }