Android 如何引导用户进入“下载”页面;谷歌播放服务“;

Android 如何引导用户进入“下载”页面;谷歌播放服务“;,android,google-play-services,Android,Google Play Services,如果设备中未安装“Google Play Services”,或者设备中的“Google Play Services”未更新,则我的应用程序将崩溃。 如果用户的设备中没有安装播放服务,我想引导用户进入“谷歌播放服务”的下载页面。 我已经应用了一个异常,但是我应该在catch块中放置什么呢? 我的意思是如何将用户引导到Play Services的下载页面?调用GooglePlayServicesUtil.isGooglePlayServicesAvailable(此)以获取状态。如果状态不是Con

如果设备中未安装“Google Play Services”,或者设备中的“Google Play Services”未更新,则我的应用程序将崩溃。 如果用户的设备中没有安装播放服务,我想引导用户进入“谷歌播放服务”的下载页面。 我已经应用了一个异常,但是我应该在catch块中放置什么呢?
我的意思是如何将用户引导到Play Services的下载页面?

调用
GooglePlayServicesUtil.isGooglePlayServicesAvailable(此)
以获取
状态。如果状态不是
ConnectionResult.SUCCESS
,请调用
GooglePlayServicesUtil.isUserRecoverableError(status)
——如果返回
true
,您应该能够使用
GooglePlayServicesUtil.getErrorDialog()
显示一个对话框,引导用户下载Play Services框架。

调用
GooglePlayServicesUtil.isGooglePlayServicesAvailable(此)
以获取
状态。如果状态不是
ConnectionResult.SUCCESS
,请调用
GooglePlayServicesUtil.isUserRecoverableError(status)
——如果返回
true
,您应该能够使用
GooglePlayServicesUtil.getErrorDialog()
显示一个对话框,引导用户下载Play Services框架。

我认为现在回答这个问题已经太迟了,但它可以帮助其他人

实施此方法,检查设备以确保其具有Google Play Services APK,如果没有,则显示一个对话框,允许用户从Google Play商店下载APK或在设备的系统设置中启用APK

public static boolean checkPlayServices(Activity activity) {
    GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    int resultCode = apiAvailability.isGooglePlayServicesAvailable(activity);
    if (resultCode != ConnectionResult.SUCCESS) {
        Log.e("GooglePlayServices", "Google play services not working.");
        if (apiAvailability.isUserResolvableError(resultCode)) {
            apiAvailability.getErrorDialog(activity, resultCode, 9000)
                    .show();
        } else {
            Log.e("GooglePlayServices", "GCM - This device is not supported.");
        }
        return false;
    }
    return true;
}

希望它能帮助某人:)

我想现在回答这个问题已经太迟了,但它可以帮助其他人

实施此方法,检查设备以确保其具有Google Play Services APK,如果没有,则显示一个对话框,允许用户从Google Play商店下载APK或在设备的系统设置中启用APK

public static boolean checkPlayServices(Activity activity) {
    GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    int resultCode = apiAvailability.isGooglePlayServicesAvailable(activity);
    if (resultCode != ConnectionResult.SUCCESS) {
        Log.e("GooglePlayServices", "Google play services not working.");
        if (apiAvailability.isUserResolvableError(resultCode)) {
            apiAvailability.getErrorDialog(activity, resultCode, 9000)
                    .show();
        } else {
            Log.e("GooglePlayServices", "GCM - This device is not supported.");
        }
        return false;
    }
    return true;
}

希望对某人有所帮助:)

谢谢你的回答。现在我可以显示一个对话框,上面说没有安装播放服务。但是点击对话框中的“确定”按钮只会将我带回我的应用程序,而不是play services的下载页面。@user2755646:如果在该对话框中没有让用户下载play services框架的选项,那么根据谷歌的估计,就无法在该设备上获得play services框架。例如,如果设备上没有Play Store或Android Market,则用户无法合法获得Play Services框架。@user2755646,您找到了什么解决方案来解决未被定向到plays Store的问题谢谢您的回答。现在我可以显示一个对话框,上面说没有安装播放服务。但是点击对话框中的“确定”按钮只会将我带回我的应用程序,而不是play services的下载页面。@user2755646:如果在该对话框中没有让用户下载play services框架的选项,那么根据谷歌的估计,就无法在该设备上获得play services框架。例如,如果设备上没有Play Store或Android Market,用户就无法合法地获得Play Services框架。@user2755646,您找到了什么解决方案来解决未被定向到plays Store的问题