@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mShouldFinishOnStop = false; setContentView(R.layout.activity_sign_in); activityComponent().inject(this); ButterKnife.bind(this); mSignInPresenter.attachView(this); setSignInButtonEnabled(false); int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if (resultCode == ConnectionResult.SUCCESS) { setSignInButtonEnabled(true); } else if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) { GooglePlayServicesUtil .getErrorDialog(resultCode, this, REQUEST_CODE_PLAY_SERVICES) .show(); } else { showNoPlayServicesError(); Timber.e("This device doesn't support Play Services"); } String popUpMessage = getIntent().getStringExtra(EXTRA_POPUP_MESSAGE); if (popUpMessage != null) { DialogFactory.createSimpleOkErrorDialog(this, popUpMessage).show(); } }
private boolean checkPlayServices() { int resultCode = GooglePlayServicesUtil .isGooglePlayServicesAvailable(app); if (resultCode != ConnectionResult.SUCCESS) { if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) { GooglePlayServicesUtil.getErrorDialog(resultCode, activity, PLAY_SERVICES_RESOLUTION_REQUEST).show(); } else { Log.i(TAG, "This device is not supported."); } return false; } return true; }
private boolean checkPlayServices() { int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if (resultCode != ConnectionResult.SUCCESS) { if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) { GooglePlayServicesUtil.getErrorDialog(resultCode, this, PLAY_SERVICES_RESOLUTION_REQUEST).show(); } else { //finish(); } return false; } return true; }
/** * Check that Google Play services APK is installed and up to date. */ private boolean checkGooglePlayServicesAvailable() { final int connectionStatusCode = GooglePlayServicesUtil .isGooglePlayServicesAvailable(this); if (GooglePlayServicesUtil.isUserRecoverableError(connectionStatusCode)) { showGooglePlayServicesAvailabilityErrorDialog(connectionStatusCode); return false; } return true; }
private boolean isGooglePlayServicesAvailable() { if(this.playServicesAvailable != null){ return this.playServicesAvailable; } final int connectionStatusCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if (GooglePlayServicesUtil.isUserRecoverableError(connectionStatusCode)) { showGooglePlayServicesAvailabilityErrorDialog(connectionStatusCode); return this.playServicesAvailable = Boolean.FALSE; } else if (connectionStatusCode != ConnectionResult.SUCCESS ) { return this.playServicesAvailable = Boolean.FALSE; } return this.playServicesAvailable = Boolean.TRUE; }
private boolean isGooglePlayInstalled() { int resultCode = GooglePlayServicesUtil .isGooglePlayServicesAvailable(this); if (resultCode != ConnectionResult.SUCCESS) { if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) { GooglePlayServicesUtil.getErrorDialog(resultCode, this, ACTION_PLAY_SERVICES_DIALOG).show(); } else { Toast.makeText(getApplicationContext(), "Google Play Service is not installed", Toast.LENGTH_SHORT).show(); finish(); } return false; } return true; }
public static boolean showDialogIfNotAvailable(FragmentActivity activity) { removeDialog(activity); int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(activity); boolean available = status == ConnectionResult.SUCCESS; if (!available) { if (GooglePlayServicesUtil.isUserRecoverableError(status)) { showDialog(status, activity); } else { ToastHelper.showToast(activity.getApplication(), "Google Play services not available"); } } return available; }
private void init(final Activity activity) { // If the client has already been created, ensure connected and return. if (sGoogleApiClient != null) { if (!sGoogleApiClient.isConnected()) sGoogleApiClient.connect(); return; } int errorCode = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(activity); // If the correct Google Play Services are available, connect and return. if (errorCode == ConnectionResult.SUCCESS) { GoogleApiCallbacks googleApiCallbacks = new GoogleApiCallbacks(); sGoogleApiClient = new GoogleApiClient.Builder(activity.getApplicationContext()) .addConnectionCallbacks(googleApiCallbacks) .addOnConnectionFailedListener(googleApiCallbacks) .addApi(LocationServices.API) .build(); sGoogleApiClient.connect(); return; } // If the correct Google Play Services are not available, redirect to proper solution. if (GooglePlayServicesUtil.isUserRecoverableError(errorCode)) { GoogleApiAvailability.getInstance() .getErrorDialog(activity, errorCode, ACTIVITY_REQUEST_CODE) .show(); return; } if (Log.isLoggable(Log.ERROR)) Log.e("Cannot update Google Play Services: " + errorCode); }
status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity()); if (status != ConnectionResult.SUCCESS) { if (GooglePlayServicesUtil.isUserRecoverableError(status)) { GooglePlayServicesUtil.getErrorDialog(status, getActivity(), 100).show();