简体   繁体   English

在没有GCM的情况下处理设备

[英]Handling a device without GCM

I am new to android programming. 我是android编程的新手。 My app runs the push notifications from GCM. 我的应用程序运行来自GCM的推送通知。 I'm testing it on multiple devices. 我正在多台设备上进行测试。 On one tablet that I have, it throws the exception Device does not have package com.google.android.gsf Now I know how to fix this on android emulator, as it is posted here . 在我拥有的一台平板电脑上,它抛出异常设备不具有com.google.android.gsf软件包现在,我知道如何在android仿真器上修复此问题,因为它已在此处发布。

My question is as an app developer how do I handle this, if the person using the app does not have com.google.android.gsf? 我的问题是作为应用程序开发人员,如果使用该应用程序的人没有com.google.android.gsf,我该如何处理? What exactly does this mean? 这到底是什么意思? Do they have to have a google account setup in their phone? 他们必须在手机中设置Google帐户吗? What about all the people that use yahoo or hotmail? 所有使用yahoo或hotmail的人呢?

A Google Account used to be mandatory for GCM registration on pre 4.0.4 Android versions. 在Android 4.0.4之前的版本中,GCM注册必须使用Google帐户。 That is not the case anymore. 事实不再如此。

If your app uses Google Play Services to register to GCM, you no longer need a Google Account, regardless of the Android version. 如果您的应用使用Google Play服务注册到GCM,则无论Android版本如何,您都不再需要Google帐户。 If you are using the old client library (which contains the GCMRegistrar class), you still need a Google Account. 如果您使用的是旧的客户端库(包含GCMRegistrar类),则仍需要一个Google帐户。

Here's what an Google developer wrote about it (taken from here ) : 这是Google开发人员写的(摘自此处 ):

Some background: Froyo and Gingerbread registration is implemented in GoogleServicesFramework, using the Google account for registration. 背景知识:Froyo和Gingerbread注册是使用Google帐户注册在GoogleServicesFramework中实现的。 This has resulted in a lot of auth errors for people where the account was not in a good state. 对于帐户状态不佳的用户,这会导致很多身份验证错误。

Starting with ICS, GCM doesn't depend or uses the Google account - you can use it before you add an account or without any accounts. 从ICS开始,GCM并不依赖或使用Google帐户-您可以在添加帐户之前使用它,也可以不使用任何帐户。

The "Play Services" update is implementing the new scheme on all devices - but it seems a small number of devices have problems with this, we're investigating - but the numbers are far lower than those with the old scheme. “ Play Services”更新正在所有设备上实施新方案-但是,我们正在调查中,似乎有少数设备对此存在问题-但数量远低于旧方案。

If you want to use the code in GSF, for Froyo and Gingerbread - you need to use the previous library, which sets package name explicitly. 如果要在Froyo和Gingerbread中使用GSF中的代码,则需要使用以前的库,该库显式设置了程序包名称。 The new library in GCM is using the new registration code. GCM中的新库正在使用新的注册码。

The actual connection to google is following the same path - we're gradually (and slowly) moving devices to the new code in play services. 与google的实际连接遵循相同的路径-我们正在(缓慢地)将设备移至Play服务中的新代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM