【问题标题】:[Android]This app won't run unless you update google play services[Android]除非您更新 google play 服务,否则此应用将无法运行
【发布时间】:2016-07-29 22:50:25
【问题描述】:

我为我的应用程序实现了一个谷歌帐户登录按钮,当我打开应用程序(Android 6.0.1)并进入登录页面时,它会显示一个对话框,说 除非您更新,否则此应用程序将无法运行谷歌播放服务

这是我的代码:

compile 'com.google.android.gms:play-services:9.2.1'
compile 'com.google.android.gms:play-services-auth:9.2.1'

public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);

        GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                .requestEmail()
                .build();
        mGoogleApiClient = new GoogleApiClient.Builder(getActivity().getApplicationContext())
                .addApi(Auth.GOOGLE_SIGN_IN_API)
                .addConnectionCallbacks(this)
                .addOnConnectionFailedListener(this)
                .build();
        mGoogleApiClient.connect();
    }

我检查了我的 android 设备上的 google play 服务是 8.1.86 是因为 8.1 如何避免我的用户使用过时的谷歌播放服务应用程序出现此消息?

【问题讨论】:

    标签: android google-api google-play google-play-services


    【解决方案1】:

    为了检查 Google Play 服务,您可以使用int isGooglePlayServicesAvailable (Context) 方法:

        GoogleApiAvailability.getInstance()
            .isGooglePlayServicesAvailable(context);
    

    如果 resultCode = SUCCESS 那么一切都很好。否则,您决定做什么,如果SERVICE_VERSION_UPDATE_REQUIRED 您可以询问用户是否要更新或者您可能有其他登录选项。

    如果您要显示原始对话框,请调用boolean showErrorDialogFragment (Activity activity, int errorCode, int requestCode)

    【讨论】:

      猜你喜欢
      • 2013-09-23
      • 1970-01-01
      • 2013-10-21
      • 2014-06-20
      • 2012-11-21
      • 1970-01-01
      • 1970-01-01
      • 2017-12-08
      相关资源
      最近更新 更多