Search in sources :

Example 16 with GoogleApiAvailability

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);
}
Also used : GoogleApiAvailability(com.google.android.gms.common.GoogleApiAvailability)

Example 17 with GoogleApiAvailability

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);
}
Also used : GoogleApiAvailability(com.google.android.gms.common.GoogleApiAvailability)

Example 18 with GoogleApiAvailability

use of com.google.android.gms.common.GoogleApiAvailability in project iosched by google.

the class MessagingRegistrationWithGCM method checkPlayServices.

/**
     * Check the device to make sure it has the Google Play Services APK. If it doesn't, display a
     * dialog that allows users to download the APK from the Google Play Store or enable it in the
     * device's system settings.
     */
private boolean checkPlayServices() {
    GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    int resultCode = apiAvailability.isGooglePlayServicesAvailable(mActivity);
    if (resultCode != ConnectionResult.SUCCESS) {
        if (apiAvailability.isUserResolvableError(resultCode)) {
            apiAvailability.getErrorDialog(mActivity, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST).show();
        } else {
            LOGI(TAG, "Google Play Services is not available on this device.");
        }
        return false;
    }
    return true;
}
Also used : GoogleApiAvailability(com.google.android.gms.common.GoogleApiAvailability)

Example 19 with GoogleApiAvailability

use of com.google.android.gms.common.GoogleApiAvailability in project robolectric by robolectric.

the class ShadowGoogleApiAvailabilityTest method getInstance.

@Test
public void getInstance() {
    //Given the expected GoogleApiAvailability instance
    final GoogleApiAvailability expected = GoogleApiAvailability.getInstance();
    //When getting the actual one from the shadow
    final GoogleApiAvailability actual = ShadowGoogleApiAvailability.getInstance();
    //Then verify that the expected is a not null and equal to the actual one
    assertThat(expected).isNotNull().isEqualTo(actual);
}
Also used : GoogleApiAvailability(com.google.android.gms.common.GoogleApiAvailability) Test(org.junit.Test)

Example 20 with GoogleApiAvailability

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);
}
Also used : GoogleApiAvailability(com.google.android.gms.common.GoogleApiAvailability)

Aggregations

GoogleApiAvailability (com.google.android.gms.common.GoogleApiAvailability)20 Dialog (android.app.Dialog)1 DialogInterface (android.content.DialogInterface)1 Test (org.junit.Test)1