android – 可选安装Google Play服务

android – 可选安装Google Play服务,第1张

概述我正在开发一款想要使用Google Cloud Messaging的 Android应用.这又需要Google Play服务. Android开发者网站会查看如何检查Google Play服务是否可用,如果没有使用错误代码传递给GooglePlayServicesUtil.getErrorDialog(),则显示本地化对话框,允许用户跳转到Play商店以安装Google播放服务或设置以启用它. 遵 我正在开发一款想要使用Google Cloud Messaging的 Android应用.这又需要Google Play服务. AndroID开发者网站会查看如何检查Google Play服务是否可用,如果没有使用错误代码传递给GooglePlayServicesUtil.getErrorDialog(),则显示本地化对话框,允许用户跳转到Play商店以安装Google播放服务或设置以启用它.

遵循此SERVICE_MISSING条件逻辑的初始测试会显示一个对话框,显示“此应用程序无法在没有Google Play服务的情况下运行,而手机中缺少这些服务”.

但是,就我而言,Google Cloud Messaging(以及Google Play服务)只需支持可选功能.说应用程序“不会运行”是不正确的.但该文本来自GooglePlayServicesUtil.

我可以使用我选择的文本构建自己的对话框,而不是使用getErrorDialog(),但据我所知,Play服务的Play商店网址不公开.我还没有尝试过,但我可以预见到一个类似的问题迫在眉睫的SERVICE_Disabled路径.

任何人都知道如何通过GooglePlayServicesUtil的秘密行动来构建特定于应用的文本?

解决方法 由于Google Play服务的资源位于库项目中,因此您应该可以在自己的应用中覆盖它们.您将在strings.xml文件中找到以下内容(以及其他字符串):

<!-- (For phones) Message in confirmation dialog informing user that     they need to install Google Play services (from Play Store) [CHAR liMIT=NONE] -->    <string name="common_Google_play_services_install_text_phone" msgid="2122112764540849864">This app won\'t run without Google Play services,which are missing from your phone.</string><!-- (For tablets) Message in confirmation dialog informing user that    they need to install Google Play services (from Play Store) [CHAR liMIT=NONE] -->    <string name="common_Google_play_services_install_text_tablet" msgid="7351599665250191022">This app won\'t run without Google Play services,which are missing from your tablet.</string>
总结

以上是内存溢出为你收集整理的android – 可选安装Google Play服务全部内容,希望文章能够帮你解决android – 可选安装Google Play服务所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1127506.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存