当前位置: 首页>>代码示例>>Java>>正文


Java ConnectionResult.SUCCESS属性代码示例

本文整理汇总了Java中com.google.android.gms.common.ConnectionResult.SUCCESS属性的典型用法代码示例。如果您正苦于以下问题:Java ConnectionResult.SUCCESS属性的具体用法?Java ConnectionResult.SUCCESS怎么用?Java ConnectionResult.SUCCESS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.google.android.gms.common.ConnectionResult的用法示例。


在下文中一共展示了ConnectionResult.SUCCESS属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkGooglePlayServices

/**
 * A utility method to validate that the appropriate version of the Google Play Services is
 * available on the device. If not, it will open a dialog to address the issue. The dialog
 * displays a localized message about the error and upon user confirmation (by tapping on
 * dialog) will direct them to the Play Store if Google Play services is out of date or
 * missing, or to system settings if Google Play services is disabled on the device.
 */
public static boolean checkGooglePlayServices(final Activity activity) {
    final int googlePlayServicesCheck = GooglePlayServicesUtil.isGooglePlayServicesAvailable(
            activity);
    switch (googlePlayServicesCheck) {
        case ConnectionResult.SUCCESS:
            return true;
        default:
            Dialog dialog = GooglePlayServicesUtil.getErrorDialog(googlePlayServicesCheck,
                    activity, 0);
            dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialogInterface) {
                    activity.finish();
                }
            });
            dialog.show();
    }
    return false;
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:26,代码来源:Utils.java

示例2: configureJobManager

private static JobManager configureJobManager(Context context) {
    Configuration.Builder builder = new Configuration.Builder(context)
            .minConsumerCount(1)//always keep at least one consumer alive
            .maxConsumerCount(3)//up to 3 consumers at a time
            .loadFactor(3)//3 jobs per consumer
            .consumerKeepAlive(120)//wait 2 minutes
            .customLogger(customLogger);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        builder.scheduler(FrameworkJobSchedulerService.createSchedulerFor(context,
                SchedulerJobService.class), true);
    } else {
        int enableGcm = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);
        if (enableGcm == ConnectionResult.SUCCESS) {
            builder.scheduler(GcmJobSchedulerService.createSchedulerFor(context,
                    GcmJobSchedulerService.class), true);
        }
    }
    return new JobManager(builder.build());
}
 
开发者ID:jshvarts,项目名称:OfflineSampleApp,代码行数:19,代码来源:JobManagerFactory.java

示例3: 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(this);
    if (resultCode != ConnectionResult.SUCCESS) {
        if (apiAvailability.isUserResolvableError(resultCode)) {
            apiAvailability.getErrorDialog(this, resultCode,
                    PLAY_SERVICES_RESOLUTION_REQUEST).show();
        } else {
            Log.i(LOG_TAG, "This device is not supported.");
            finish();
        }
        return false;
    }
    return true;
}
 
开发者ID:changja88,项目名称:Udacity_Sunshine,代码行数:20,代码来源:MainActivity.java

示例4: 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.
 */
public static boolean checkPlayServices(AppCompatActivity activity, int PLAY_SERVICES_RESOLUTION_REQUEST) {
    GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    int resultCode = apiAvailability.isGooglePlayServicesAvailable(activity);
    if (resultCode != ConnectionResult.SUCCESS) {
        if (apiAvailability.isUserResolvableError(resultCode)) {
            apiAvailability.getErrorDialog(activity, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST)
                    .show();
        } else {
            MaterialDialog dialog = new MaterialDialog.Builder(activity)
                    .content("This device is not supported.")
                    .show();
        }
        return false;
    }
    return true;
}
 
开发者ID:SalmanTKhan,项目名称:MyAnimeViewer,代码行数:21,代码来源:PlayServicesUtils.java

示例5: isGooglePlayServicesAvailable

public boolean isGooglePlayServicesAvailable() {
    GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
    int code = googleApiAvailability.isGooglePlayServicesAvailable(context);
    if (code != ConnectionResult.SUCCESS) {
        if (googleApiAvailability.isUserResolvableError(code)) {
            googleApiAvailability.getErrorDialog(context, code, PLAY_SERVICE_RESOLUTION_REQUEST, this);
        } else {
            showLog("THIS DEVICE IS NOT SUPPORTED");
            Util.killAppProccess();
        }
        showLog("isGooglePlayServicesAvailable - " + "false");
        return false;
    }
    showLog("isGooglePlayServicesAvailable - " + "true");
    return true;
}
 
开发者ID:pedromassango,项目名称:Programmers,代码行数:16,代码来源:GoogleServices.java

示例6: checkPlayServicesAvailable

/**
 * 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.
 *
 * @param activity activity where you check Google Play Services availability
 */
public boolean checkPlayServicesAvailable(Activity activity) {
    GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    int resultCode = apiAvailability.isGooglePlayServicesAvailable(activity);
    if (resultCode != ConnectionResult.SUCCESS) {
        if (apiAvailability.isUserResolvableError(resultCode)) {
            apiAvailability.getErrorDialog(activity, resultCode, PLAY_SERVICES_REQUEST_CODE)
                    .show();
        } else {
            Log.i(TAG, "This device is not supported.");
            activity.finish();
        }
        return false;
    }
    return true;
}
 
开发者ID:mobilemaster128,项目名称:quickblox-android,代码行数:22,代码来源:GooglePlayServicesHelper.java

示例7: onResume

@Override
public void onResume() {
    super.onResume();
    updateUI();
    
    //checking if Play Store app installed on device
    GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    int errorCode = apiAvailability.isGooglePlayServicesAvailable(getActivity());

    if (errorCode != ConnectionResult.SUCCESS) {
        Dialog errorDialog = apiAvailability
                .getErrorDialog(getActivity(), errorCode, REQUEST_ERROR,
                        new DialogInterface.OnCancelListener() {
                    @Override
                    public void onCancel(DialogInterface dialog) {
                        getActivity().finish();
                    }
                });
        errorDialog.show();
    }
}
 
开发者ID:plweegie,项目名称:piast-trail,代码行数:21,代码来源:PlaceListFragment.java

示例8: isGooglePlayServicesAvailable

/**
 * Check that Google Play services APK is installed and up to date.
 * @return true if Google Play Services is available and up to
 *     date on this device; false otherwise.
 */
private boolean isGooglePlayServicesAvailable() {
    GoogleApiAvailability apiAvailability =
            GoogleApiAvailability.getInstance();
    final int connectionStatusCode =
            apiAvailability.isGooglePlayServicesAvailable(this);
    return connectionStatusCode == ConnectionResult.SUCCESS;
}
 
开发者ID:jcolladosp,项目名称:ePills,代码行数:12,代码来源:ClockActivity.java

示例9: startCameraSource

private void startCameraSource() {
  // check that the device has play services available.
  int code =
      GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(getApplicationContext());
  if (code != ConnectionResult.SUCCESS) {
    GoogleApiAvailability.getInstance().getErrorDialog(this, code, RC_HANDLE_GMS).show();
  }
  if (cameraSource != null) {
    preview.start(cameraSource, graphicOverlay, PRINTED_CARD_RATIO);
  }
}
 
开发者ID:square,项目名称:kind-photo-bot,代码行数:11,代码来源:SnapActivity.java

示例10: isGooglePlayServicesAvailable

/**
 * Method to check if google play services are enabled or not
 *
 * @return boolean status
 */
public boolean isGooglePlayServicesAvailable() {
    GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
    int status = googleApiAvailability.isGooglePlayServicesAvailable(this);
    if (status != ConnectionResult.SUCCESS) {
        if (googleApiAvailability.isUserResolvableError(status)) {
            googleApiAvailability.getErrorDialog(this, status, 2404).show();
        }
        return false;
    }
    return true;
}
 
开发者ID:pmathew92,项目名称:MapsWithPlacesAutoComplete,代码行数:16,代码来源:MapsActivity.java

示例11: checkAvailability

@Override
@SuppressWarnings("unchecked")
public void checkAvailability(@NonNull final Context context, @NonNull PaymentMethod paymentMethod,
                              @NonNull final PaymentMethodAvailabilityCallback callback) {
    Log.d(TAG, "checkAvailability");

    GoogleApiAvailability googleAPI = GoogleApiAvailability.getInstance();
    int result = googleAPI.isGooglePlayServicesAvailable(context);

    if (result != ConnectionResult.SUCCESS) {
        callback.onFail(new GoogleApiClientNotInitializedException("Google API not available"));
    }
    final GoogleApiClient googleApiClient = getGoogleApiClient(context);

    if (googleApiClient != null) {
        googleApiClient.connect();
        Wallet.Payments.isReadyToPay(googleApiClient).setResultCallback(
                new ResultCallback<BooleanResult>() {
                    @Override
                    public void onResult(@NonNull BooleanResult booleanResult) {
                        if (booleanResult.getStatus().isSuccess()) {
                            callback.onSuccess(booleanResult.getValue());
                        } else {
                            Log.e(TAG, "isReadyToPay:" + booleanResult.getStatus());
                            String errorMessage = booleanResult.getStatus().getStatusCode()
                                    + booleanResult.getStatus().getStatusMessage();
                            callback.onFail(new Throwable(errorMessage));
                        }
                    }
                });
    } else {
        callback.onFail(new GoogleApiClientNotInitializedException(
                "Google API client is null or not connected"));
    }
}
 
开发者ID:Adyen,项目名称:adyen-android,代码行数:35,代码来源:AndroidPayService.java

示例12: checkPlayServices

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;
}
 
开发者ID:Mun0n,项目名称:MADBike,代码行数:13,代码来源:HomeActivity.java

示例13: checkPlayServices

/**
 * Function to check google play services
 *
 * @return Found or not
 */
private boolean checkPlayServices() {
    GoogleApiAvailability googleAPI = GoogleApiAvailability.getInstance();
    int result = googleAPI.isGooglePlayServicesAvailable(context);
    if (result != ConnectionResult.SUCCESS) {
        if (googleAPI.isUserResolvableError(result)) {
            googleAPI.getErrorDialog((Activity) context, result,
                    1).show();
        }

        return false;
    }

    return true;
}
 
开发者ID:fekracomputers,项目名称:MuslimMateAndroid,代码行数:19,代码来源:FusedLocationService.java

示例14: checkGooglePlayService

private void checkGooglePlayService() {
    GoogleApiAvailability googleAPI = GoogleApiAvailability.getInstance();
    int result = googleAPI.isGooglePlayServicesAvailable(this);
    if(result != ConnectionResult.SUCCESS) {
        if (googleAPI.isUserResolvableError(result)) {
            googleAPI.getErrorDialog(this, result,
                    0).show();
        }
    }
}
 
开发者ID:LewisVo,项目名称:Overkill,代码行数:10,代码来源:MainActivity.java

示例15: servicesAvailable

private boolean servicesAvailable() {
    int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity());

    if (ConnectionResult.SUCCESS == resultCode) {
        return true;
    } else {
        GooglePlayServicesUtil.getErrorDialog(resultCode, getActivity(), 0).show();
        return false;
    }
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-android,代码行数:10,代码来源:LocationClient.java


注:本文中的com.google.android.gms.common.ConnectionResult.SUCCESS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。