gpt4 book ai didi

android - 推送通知的最低 Google Play 服务版本

转载 作者:塔克拉玛干 更新时间:2023-11-02 18:58:17 26 4
gpt4 key购买 nike

我正在使用 Google Cloud Messaging 在 Android 手机上接收推送通知。我成功了,一切似乎都很顺利。但是,Google 建议检查 Google Play Services 是否更新到最新版本(因为 Push Notifications 是一项新功能)。

使用 Nexus 7 (4.4.4) 并在 Activity 开始时启用版本检查 我需要更新我的 Google Play 服务,因为有更新的版本。但是,即使没有更新,推送通知也能完美运行。如果不是绝对必要,我不想要求我的用户更新 Google Play 服务。

我的问题:为了从 GCM 接收推送通知,我应该检查 Google Play 服务的最低版本是什么?

这是代码:

    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;
}

备注:我不需要检查最新版本的谷歌播放服务,但支持推送通知的最低版本

编辑:我根据评论做了一些澄清

最佳答案

我有一个启用了 GCM 的应用程序。正如我在我的数据库中看到的那样,存在 Google Play 服务版本高于 3.0.27 的用户。

但要小心使用 GcmNetworkManager,因为它至少需要 google play 服务 7.5.0

关于android - 推送通知的最低 Google Play 服务版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26126499/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com