use of com.google.android.gms.common.GoogleApiAvailability in project cw-omnibus by commonsguy.
the class AbstractMapActivity method readyToGo.
protected boolean readyToGo() {
GoogleApiAvailability checker = GoogleApiAvailability.getInstance();
int status = checker.isGooglePlayServicesAvailable(this);
if (status == ConnectionResult.SUCCESS) {
if (getVersionFromPackageManager(this) >= 2) {
return (true);
} else {
Toast.makeText(this, R.string.no_maps, Toast.LENGTH_LONG).show();
finish();
}
} else if (checker.isUserResolvableError(status)) {
ErrorDialogFragment.newInstance(status).show(getFragmentManager(), TAG_ERROR_DIALOG_FRAGMENT);
} else {
Toast.makeText(this, R.string.no_maps, Toast.LENGTH_LONG).show();
finish();
}
return (false);
}
use of com.google.android.gms.common.GoogleApiAvailability in project cw-omnibus by commonsguy.
the class AbstractMapActivity method readyToGo.
protected boolean readyToGo() {
GoogleApiAvailability checker = GoogleApiAvailability.getInstance();
int errorCode = checker.isGooglePlayServicesAvailable(this);
if (errorCode == ConnectionResult.SUCCESS) {
if (getVersionFromPackageManager(this) >= 2) {
return (true);
} else {
Toast.makeText(this, R.string.no_maps, Toast.LENGTH_LONG).show();
finish();
}
} else if (checker.isUserResolvableError(errorCode)) {
ErrorDialogFragment.newInstance(errorCode).show(getFragmentManager(), TAG_ERROR_DIALOG_FRAGMENT);
} else {
Toast.makeText(this, R.string.no_maps, Toast.LENGTH_LONG).show();
finish();
}
return (false);
}
use of com.google.android.gms.common.GoogleApiAvailability in project WordPress-Android by wordpress-mobile.
the class WordPress method isGooglePlayServicesAvailable.
public boolean isGooglePlayServicesAvailable(Activity activity) {
GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
int connectionResult = googleApiAvailability.isGooglePlayServicesAvailable(activity);
switch(connectionResult) {
// Success: return true
case ConnectionResult.SUCCESS:
return true;
// Play Services unavailable, show an error dialog is the Play Services Lib needs an update
case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
Dialog dialog = googleApiAvailability.getErrorDialog(activity, connectionResult, 0);
if (dialog != null) {
dialog.show();
}
default:
case ConnectionResult.SERVICE_MISSING:
case ConnectionResult.SERVICE_DISABLED:
case ConnectionResult.SERVICE_INVALID:
AppLog.w(T.NOTIFS, "Google Play Services unavailable, connection result: " + googleApiAvailability.getErrorString(connectionResult));
}
return false;
}
use of com.google.android.gms.common.GoogleApiAvailability in project IITB-App by wncc.
the class LoginActivity method checkPlayServices.
private boolean checkPlayServices() {
GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
int resultCode = apiAvailability.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (apiAvailability.isUserResolvableError(resultCode)) {
apiAvailability.getErrorDialog(this, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
Log.i(TAG, "This device is not supported.");
finish();
}
return false;
}
return true;
}
use of com.google.android.gms.common.GoogleApiAvailability in project cw-omnibus by commonsguy.
the class AbstractMapActivity method readyToGo.
protected boolean readyToGo() {
GoogleApiAvailability checker = GoogleApiAvailability.getInstance();
int status = checker.isGooglePlayServicesAvailable(this);
if (status == ConnectionResult.SUCCESS) {
if (getVersionFromPackageManager(this) >= 2) {
return (true);
} else {
Toast.makeText(this, R.string.no_maps, Toast.LENGTH_LONG).show();
finish();
}
} else if (checker.isUserResolvableError(status)) {
ErrorDialogFragment.newInstance(status).show(getFragmentManager(), TAG_ERROR_DIALOG_FRAGMENT);
} else {
Toast.makeText(this, R.string.no_maps, Toast.LENGTH_LONG).show();
finish();
}
return (false);
}
Aggregations