【问题标题】:Don't show "This app won't run without google play services" dialog不显示“如果没有 Google Play 服务,此应用将无法运行”对话框
【发布时间】:2016-03-01 12:21:26
【问题描述】:

我在我的应用中使用 Google Play 服务,但它不是必须运行的。但是,当设备没有 Google Play 服务时,它会显示一个对话框,其中显示:没有 Google Play 服务,此应用将无法运行。

问题是,我可以更改此文本吗?没找到。

我的代码:

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(TAG, "This device is not supported.");
            finish();
        }
        return false;
    }
    return true;
}

【问题讨论】:

  • 我猜你可以只显示一个自定义对话框而不是apiAvailability.getErrorDialog(this, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST).show();
  • 有道理,谢谢!
  • 我会把它作为答案发布:)

标签: java android google-play-services


【解决方案1】:

我猜你可以只显示一个自定义对话框而不是 apiAvailability.getErrorDialog(this, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST).show();

【讨论】:

    猜你喜欢
    • 2015-08-14
    • 1970-01-01
    • 1970-01-01
    • 2021-12-10
    • 1970-01-01
    • 2023-03-21
    • 2021-09-15
    • 2013-09-23
    • 1970-01-01
    相关资源
    最近更新 更多