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


Java GooglePlayServicesUtil.isUserRecoverableError方法代码示例

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


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

示例1: checkPlayServices

import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
private boolean checkPlayServices() {
    int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
    if (resultCode != ConnectionResult.SUCCESS) {
        if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
            GooglePlayServicesUtil.getErrorDialog(
                    resultCode, this, REQUEST_CODE_PLAY_SERVICES).show();
        } else {
            Dialog playServicesDialog = DialogFactory.createSimpleOkErrorDialog(
                    this,
                    getString(R.string.dialog_error_title),
                    getString(R.string.error_message_play_services)
            );
            playServicesDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public void onDismiss(DialogInterface dialog) {
                    finish();
                }
            });
            playServicesDialog.show();
        }
        return false;
    }
    return true;
}
 
开发者ID:sathishmscict,项目名称:Pickr,代码行数:25,代码来源:MainActivity.java

示例2: checkPlayServices

import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
private boolean checkPlayServices() {

        int resultCode = GooglePlayServicesUtil
                .isGooglePlayServicesAvailable(getActivity());
        if (resultCode != ConnectionResult.SUCCESS) {
            if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
                GooglePlayServicesUtil.getErrorDialog(resultCode, getActivity(),
                        PLAY_SERVICES_RESOLUTION_REQUEST).show();
            } else {
                Toast.makeText(getContext(),
                        getString(R.string.location_services_not_supported), Toast.LENGTH_LONG)
                        .show();
                getActivity().finish();
            }
            return false;
        }

        return true;
    }
 
开发者ID:juanjecilla,项目名称:FindMeAHome,代码行数:20,代码来源:LocationFragment.java

示例3: checkPlayService

import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
private boolean checkPlayService(FragmentActivity fragmentActivity)
        throws IllegalArgumentException {
    int errorCode =
            GooglePlayServicesUtil.
                    isGooglePlayServicesAvailable(fragmentActivity);
    if (ConnectionResult.SUCCESS != errorCode) {
        if (GooglePlayServicesUtil.isUserRecoverableError(errorCode)) {
            Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(
                    errorCode, fragmentActivity, REQUEST_CODE);

            ErrorDialogFragment errorFragment =
                    new ErrorDialogFragment();
            errorFragment.setDialog(errorDialog);
            errorFragment.show(fragmentActivity.getSupportFragmentManager(),
                    TAG);

            return false;
        } else {
            throw new IllegalArgumentException("Play Service not supported in this device");
        }
    } else {
        return true;
    }
}
 
开发者ID:salemoh,项目名称:GoldenQuranAndroid,代码行数:25,代码来源:LocationHelper.java

示例4: checkPlayServices

import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
public static boolean checkPlayServices(Context act) {

        Activity activity = (Activity)act;

        int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(activity);
        if (resultCode != ConnectionResult.SUCCESS) {
            if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
                GooglePlayServicesUtil.getErrorDialog(resultCode, activity,
                        AppConstants.PLAY_SERVICES_RESOLUTION_REQUEST).show();
            } else {
                Log.i("checkPlayServices", "This device is not supported.");
                activity.finish();
            }
            return false;
        }
        return true;
    }
 
开发者ID:WasimMemon,项目名称:SocialSignIn_Demo,代码行数:18,代码来源:Utility.java

示例5: checkGooglePlayServicesAvailable

import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
private boolean checkGooglePlayServicesAvailable()
{
    final int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
    if (status == ConnectionResult.SUCCESS)
    {
        return true;
    }

    Log.e("MAIN ACTIVITY", "Google Play Services not available: " + GooglePlayServicesUtil.getErrorString(status));

    if (GooglePlayServicesUtil.isUserRecoverableError(status))
    {
        final Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(status, this, 1);
        if (errorDialog != null)
        {
            errorDialog.show();
        }
    }

    return false;
}
 
开发者ID:Peter-Wilson,项目名称:Flock,代码行数:22,代码来源:MainActivity.java

示例6: checkPlayServices

import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
/**
 * Method to verify google play services on the device
 * */
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 {
            Toast.makeText(getApplicationContext(),
                    "This device is not supported.", Toast.LENGTH_LONG)
                    .show();
            finish();
        }
        return false;
    }
    return true;
}
 
开发者ID:ahmadaghazadeh,项目名称:Location,代码行数:21,代码来源:AddActivity.java

示例7: isGoogelPlayInstalled

import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
private boolean isGoogelPlayInstalled() {
    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;

}
 
开发者ID:DiogoPeres,项目名称:WhosUp,代码行数:19,代码来源:GCMActivity.java

示例8: checkPlayServices

import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
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 {
            Toast.makeText(getApplicationContext(),
                    "This device is not supported.", Toast.LENGTH_LONG)
                    .show();
            finish();
        }
        return false;
    }
    return true;
}
 
开发者ID:terell-brown-zz,项目名称:android-grand-river-transit-app,代码行数:17,代码来源:NearbyStopsActivity.java

示例9: checkPlayServices

import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
/** Are we still able to use Play Services?
 *
 * @return boolean
 */
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();
            //toggleConnectToSend(false);

        } else {
            Log.i(TAG, "This device is not supported");
            finish();
        }
        return false;
    }
    return true;
}
 
开发者ID:jrconlin,项目名称:SimplePushDemoApp-Android,代码行数:21,代码来源:MainActivity.java

示例10: showErrorDialog

import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
private void showErrorDialog(ConnectionResult connectionResult) {
    int errorCode = connectionResult.getErrorCode();

    if (GooglePlayServicesUtil.isUserRecoverableError(errorCode)) {
        // Show the default Google Play services error dialog which may still start an intent
        // on our behalf if the user can resolve the issue.
        GooglePlayServicesUtil.getErrorDialog(errorCode, this, RC_SIGN_IN,
                new DialogInterface.OnCancelListener() {
                    @Override
                    public void onCancel(DialogInterface dialog) {
                        mShouldResolve = false;
                        updateUI(false);
                    }
                }).show();
    } else {
        // No default Google Play Services error, display a message to the user.
        String errorString = getString(R.string.play_services_error_fmt, errorCode);
        Toast.makeText(this, errorString, Toast.LENGTH_SHORT).show();

        mShouldResolve = false;
        updateUI(false);
    }
}
 
开发者ID:rokity,项目名称:GCM-Sample,代码行数:24,代码来源:MainActivity.java

示例11: checkPlayServices

import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
/**
 * Checks if Google Play Services are installed and if not it initializes
 * opening the dialog to allow user to install Google Play Services.
 * @return a boolean indicating if the Google Play Services are available.
 */
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 {
            Log.i(TAG, "This device is not supported.");
            finish();
        }
        return false;
    }
    return true;
}
 
开发者ID:googlearchive,项目名称:MobileShoppingAssistant-sample,代码行数:21,代码来源:MainActivity.java

示例12: checkPlayServices

import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的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() {
    final int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(cordova.getActivity());
    if (resultCode != ConnectionResult.SUCCESS) {
        if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
            cordova.getActivity().runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    GooglePlayServicesUtil.getErrorDialog(resultCode, cordova.getActivity(), 9000).show();
                }
            });
        } else {
            Log.i(TAG, "This device is not supported.");
            cordova.getActivity().finish();
        }
        return false;
    }
    return true;
}
 
开发者ID:gonzaloaune,项目名称:GCMPushPlugin,代码行数:24,代码来源:GCMPushPlugin.java

示例13: checkPlayServices

import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
private boolean checkPlayServices() {
    int resultCode = GooglePlayServicesUtil
            .isGooglePlayServicesAvailable(this);
    // When Play services not found in device
    if (resultCode != ConnectionResult.SUCCESS) {
        if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
            // Show Error dialog to install Play services
            GooglePlayServicesUtil.getErrorDialog(resultCode, this,
                    PLAY_SERVICES_RESOLUTION_REQUEST).show();
        } else {
            Toast.makeText(
                    getApplicationContext(),
                    "This device doesn't support Play services, App will not work normally",
                    Toast.LENGTH_LONG).show();
            finish();
        }
        return false;
    } else {
        Toast.makeText(
                getApplicationContext(),
                "This device supports Play services, App will work normally",
                Toast.LENGTH_LONG).show();
    }
    return true;
}
 
开发者ID:kikitsa,项目名称:csd-Thesis,代码行数:26,代码来源:Message.java

示例14: checkPlayServices

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

示例15: onConnectionFailed

import com.google.android.gms.common.GooglePlayServicesUtil; //导入方法依赖的package包/类
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
    Activity activity = getActivity("onConnectionFailed()");
    if (activity == null) {
        return;
    }

    if (connectionResult.hasResolution()) {
        if (sCanShowSignInUi) {
            LOGD(TAG, "onConnectionFailed, with resolution. Attempting to resolve.");
            sCanShowSignInUi = false;
            try {
                mResolving = true;
                connectionResult.startResolutionForResult(activity,
                        REQUEST_RECOVER_FROM_PLAY_SERVICES_ERROR);
            } catch (IntentSender.SendIntentException e) {
                LOGE(TAG, "SendIntentException occurred: " + e.getMessage());
                e.printStackTrace();
            }
        } else {
            LOGD(TAG, "onConnectionFailed with resolution but sCanShowSignInUi==false.");
            reportAuthFailure();
        }
        return;
    }

    LOGD(TAG, "onConnectionFailed, no resolution.");
    final int errorCode = connectionResult.getErrorCode();
    if (GooglePlayServicesUtil.isUserRecoverableError(errorCode) && sCanShowSignInUi) {
        sCanShowSignInUi = false;
        GooglePlayServicesUtil.getErrorDialog(errorCode, activity,
                REQUEST_PLAY_SERVICES_ERROR_DIALOG).show();
    } else {
        reportAuthFailure();
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:37,代码来源:LoginAndAuthHelper.java


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