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


Java GoogleApiAvailability.isUserResolvableError方法代码示例

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


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

示例1: checkPlayServicesAvailable

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
/**
 * 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,代码行数:23,代码来源:GooglePlayServicesHelper.java

示例2: checkPlayServices

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
private boolean checkPlayServices() {
    GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    int resultCode = apiAvailability.isGooglePlayServicesAvailable(this);
    if (resultCode != ConnectionResult.SUCCESS) {
        if (apiAvailability.isUserResolvableError(resultCode)) {
            apiAvailability.getErrorDialog(this, resultCode, 9000, new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialog) {
                    finish();
                }
            }).show();
        } else {
            Log.i(TAG, "This device is not supported.");
            finish();
        }
        return false;
    }
    return true;
}
 
开发者ID:squareboat,项目名称:Excuser,代码行数:20,代码来源:MainWearActivity.java

示例3: checkPlayServices

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
public static boolean checkPlayServices(Activity context) {
    GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    int resultCode = apiAvailability.isGooglePlayServicesAvailable(context);
    if (resultCode != ConnectionResult.SUCCESS) {
        if (apiAvailability.isUserResolvableError(resultCode)) {
            apiAvailability.getErrorDialog(context, resultCode, 9000).show();
        } else {
            AlertDialog.Builder alert = new AlertDialog.Builder(context);
            alert.setTitle(context.getResources().getString(R.string.app_name));
            alert.setCancelable(false);
            alert.setMessage(R.string.play_services_warning);
            alert.setPositiveButton("Exit", (dialog, which) -> System.exit(0));
        }
        return false;
    }
    return true;
}
 
开发者ID:afiqiqmal,项目名称:MVP-Android,代码行数:18,代码来源:CommonUtils.java

示例4: checkPlayServices

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
public static boolean checkPlayServices(Activity context) {
    GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    int resultCode = apiAvailability.isGooglePlayServicesAvailable(context);
    if (resultCode != ConnectionResult.SUCCESS) {
        if (apiAvailability.isUserResolvableError(resultCode)) {
            apiAvailability.getErrorDialog(context, resultCode, 9000).show();
        } else {
            AlertDialog.Builder alert = new AlertDialog.Builder(context);
            alert.setTitle("");
            alert.setMessage("");
            alert.setPositiveButton("EXIT", (dialog, which) -> System.exit(0));
        }
        return false;
    }
    return true;
}
 
开发者ID:afiqiqmal,项目名称:MVP-Android,代码行数:17,代码来源:SubUtils.java

示例5: isGooglePlayServicesAvailable

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
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,代码行数:17,代码来源:GoogleServices.java

示例6: checkPlayServicesPrereq

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
private boolean checkPlayServicesPrereq() {
    GoogleApiAvailability googleAPI = GoogleApiAvailability.getInstance();
    int result = googleAPI.isGooglePlayServicesAvailable(this);
    if (result != ConnectionResult.SUCCESS) {
        if (googleAPI.isUserResolvableError(result)) {
            googleAPI.getErrorDialog(this, result, 0).show();

            Crashlytics.log(Log.INFO, MainActivity.class.getSimpleName(), "PlayServices update required");
            Answers.getInstance().logCustom(new CustomEvent("PlayServices update required"));
        } else {
            playServicesErrorToast.show();

            Crashlytics.log(Log.ERROR, MainActivity.class.getSimpleName(), "PlayServices incompatible");
            Answers.getInstance().logCustom(new CustomEvent("PlayServices incompatible"));
        }
        return false;
    }

    Crashlytics.log(Log.INFO, MainActivity.class.getSimpleName(), "PlayServices compatible");
    return true;
}
 
开发者ID:jakehilborn,项目名称:speedr,代码行数:22,代码来源:MainActivity.java

示例7: checkPlayServices

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
/**
 * 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(cordova.getActivity());
    if (resultCode != ConnectionResult.SUCCESS) {
        if (apiAvailability.isUserResolvableError(resultCode)) {
            apiAvailability.getErrorDialog(cordova.getActivity(), resultCode, PLAY_SERVICES_RESOLUTION_REQUEST)
                    .show();
        } else {
            Log.e(TAG, "This device is not supported for Google Play Services.");
            javascriptErrorback(0, "This device is not supported for Google Play Services.", mInitCallbackContext);

        }
        return false;
    }
    return true;
}
 
开发者ID:jefflinwood,项目名称:twilio-voice-phonegap-plugin,代码行数:22,代码来源:TwilioVoicePlugin.java

示例8: acquireGooglePlayServices

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
/**
 * Attempt to resolve a missing, out-of-date, invalid or disabled Google
 * Play Services installation via a user dialog, if possible.
 */
public static void acquireGooglePlayServices(Context context) {
    GoogleApiAvailability apiAvailability =
            GoogleApiAvailability.getInstance();
    final int connectionStatusCode =
            apiAvailability.isGooglePlayServicesAvailable(context);
    if (apiAvailability.isUserResolvableError(connectionStatusCode)) {
       Log.e("Error","Connection Status Code"+connectionStatusCode);
    }
}
 
开发者ID:PrivacyStreams,项目名称:PrivacyStreams,代码行数:14,代码来源:DeviceUtils.java

示例9: checkPlayServices

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
/**
 * 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 boolean checkPlayServices() {
    GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    int resultCode = apiAvailability.isGooglePlayServicesAvailable(mContext);
    if (resultCode != ConnectionResult.SUCCESS) {
        if (apiAvailability.isUserResolvableError(resultCode)) {
            apiAvailability.getErrorDialog((Activity) mContext, resultCode, 9000)
                    .show();
        } else {
            showToast(mContext.getResources().getString(R.string.warning_play_services));
        }
        return false;
    }
    return true;
}
 
开发者ID:SoftprodigyIndia,项目名称:AndroidAppBoilerplate,代码行数:20,代码来源:AppUtils.java

示例10: googleServicesAvailable

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
public boolean googleServicesAvailable() {
    GoogleApiAvailability api = GoogleApiAvailability.getInstance();
    int isAvailable = api.isGooglePlayServicesAvailable(this);
    if (isAvailable == ConnectionResult.SUCCESS) {
        return true;
    } else if (api.isUserResolvableError(isAvailable)) {
        Dialog dialog = api.getErrorDialog(this, isAvailable, 0);
        dialog.show();
    } else {
        Toast.makeText(this, "Cannot connect to Google Play Services", Toast.LENGTH_SHORT).show();
    }
    return false;
}
 
开发者ID:rahul051296,项目名称:quake-alert-android-app,代码行数:14,代码来源:QuakeActivity.java

示例11: checkForPlayServices

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
private boolean checkForPlayServices() {
    GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
    int resultCode = googleApiAvailability
            .isGooglePlayServicesAvailable(getReactApplicationContext());
    if (resultCode != ConnectionResult.SUCCESS) {
        if (googleApiAvailability.isUserResolvableError(resultCode)) {
            googleApiAvailability.getErrorDialog(getCurrentActivity(), resultCode,
                    PLAY_SERVICES_RESOLUTION_REQUEST).show();
        }
        return false;
    }
    return true;
}
 
开发者ID:MustansirZia,项目名称:react-native-fused-location,代码行数:14,代码来源:FusedLocationModule.java

示例12: acquireGooglePlayServices

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
/**
 * Attempt to resolve a missing, out-of-date, invalid or disabled Google
 * Play Services installation via a user dialog, if possible.
 */
private void acquireGooglePlayServices() {
    GoogleApiAvailability apiAvailability =
            GoogleApiAvailability.getInstance();
    final int connectionStatusCode =
            apiAvailability.isGooglePlayServicesAvailable(context);
    if (apiAvailability.isUserResolvableError(connectionStatusCode)) {
        showGooglePlayServicesAvailabilityErrorDialog(connectionStatusCode);
    }
}
 
开发者ID:Pl4gue,项目名称:homeworkManager-android,代码行数:14,代码来源:AddHomeworkPresenter.java

示例13: checkGooglePlayService

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
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,代码行数:11,代码来源:MainActivity.java

示例14: acquireGooglePlayServices

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
/**
 * Attempt to resolve a missing, out-of-date, invalid or disabled Google
 * Play Services installation via a user dialog, if possible.
 */
private void acquireGooglePlayServices() {
    GoogleApiAvailability apiAvailability =
            GoogleApiAvailability.getInstance();
    final int connectionStatusCode =
            apiAvailability.isGooglePlayServicesAvailable(getActivity());
    if (apiAvailability.isUserResolvableError(connectionStatusCode)) {
        SharedPreferences settings = getPreferenceManager().getSharedPreferences();
        SharedPreferences.Editor editor = settings.edit();
        editor.putBoolean(getString(R.string.pref_key_secure_backup_enabled), false);
        editor.apply();
        showGooglePlayServicesAvailabilityErrorDialog(connectionStatusCode);
    }
}
 
开发者ID:mkeresztes,项目名称:AndiCar,代码行数:18,代码来源:PreferenceActivity.java

示例15: checkGooglePlayAvailability

import com.google.android.gms.common.GoogleApiAvailability; //导入方法依赖的package包/类
private boolean checkGooglePlayAvailability() {
    GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
    int resultCode = googleApiAvailability.isGooglePlayServicesAvailable(context);
    if(resultCode == ConnectionResult.SUCCESS) {
        return true;
    } else {
        if(googleApiAvailability.isUserResolvableError(resultCode)) {
            googleApiAvailability.getErrorDialog(MainActivity.this, resultCode, 2404).show();
        }
    }
    return false;
}
 
开发者ID:EzequielAdrianM,项目名称:Camera2Vision,代码行数:13,代码来源:MainActivity.java


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