我正在为具有以下功能的设备编写系统应用程序
没有安装Google Play服务或Google Play商店。

我想实现推送通知。

该设备正在运行Android 4.2.2,并且官方Google GCM文档说:

A Google account is not a requirement on devices running Android 4.0.4 or higher.

但是这些文档与使用Google Play Services的GCM新版本有关(对我来说不是一个选择)

因此,我尝试使用旧的,已弃用的GCM帮助程序库。
我在设备上安装了GoogleServicesFramework4.0.x(我可以安装GSF,但不能安装Google Play服务)

我现在收到AUTHENTICATION_FAILED错误,registrationId为null
我猜这是因为设备上没有设置Google帐户。
弃用的GCM库是否需要Google帐户?
(我的SENDER_ID是正确的,我已经检查过了)

基本上,我的问题是:
如果没有Google帐户,是否可以使GCM正常工作,
使用旧的,已弃用的GCM帮助程序库?

NOTE: I mustn't create Google account on the device (this is a requirement)

如果这不可能,那么请提出另一种实现推送通知的方法。
(请注意,大多数推送通知提供程序实际上都是在"幕后"使用GCM(例如,Urban Airpush),因此不要建议这样做)。

如果可能的话,我希望避免在服务器上轮询通知("拉通知"),
谢谢。


就在您发布报价之前(关于不需要Google帐户),您拥有以下内容:

It requires devices running Android 2.2 or higher that also have the Google Play Store application installed, or or an emulator running Android 2.2 with Google APIs. However, you are not limited to deploying your Android applications through Google Play Store.

因此,看来Google Play商店是GCM运作所必需的。

Pushy是GCM的替代产品,不需要Google帐户或Google Play服务。


作为GCM的替代方案,当设备上没有Google帐户和Google Play服务时,您可以使用MQTT作为开源和流行的推送通知替代方案。 Facebook在Facebook Messenger中使用了MQTT的各个方面。

实施MQTT需要:

1)在服务器端运行的MQTT代理。这可能类似于mosquitto经纪人,它是开放源代码。

2)一个包含在Android应用程序中的MQTT客户端库,使您的应用程序可以连接,订阅和发布消息。 http://mqtt.org/software

列出了许多Java选项。

3)提出一种唯一标识用户或设备的方法,然后将其用作主题,以便您可以将消息分别发布到一个设备。
戴尔·莱恩(Dale Lane)为此写了一个不错的指南(http://dalelane.co.uk/blog/?p=1599),并且还有很多关于MQTT的资源(https://github.com/mqtt/mqtt .github.io / wiki)

此外,下面的博客文章Github示例提供了一个实际示例,用于为Android实现MQTT推送通知:

http://tokudu.com/post/50024574938/how-to-implement-push-notifications-for-android

https://github.com/tokudu/AndroidPushNotificationsDemo