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

我在我的应用中使用 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();

【讨论】:

    最近更新 更多