Is it possible to use GCM without Google account AND Google Play Services on the device?

前端 未结 2 1747
半阙折子戏
半阙折子戏 2020-12-14 22:39

I\'m writing a system app for a device that has
no Google Play Services nor Google Play Store installed.

I want to implement push notifications.

The de

相关标签:
2条回答
  • 2020-12-14 23:20

    As an alternative to GCM, you could use MQTT as an open source and popular push notification alternative when Google account and Google Play services are absent on the device. Facebook has used aspects of MQTT in Facebook Messenger.

    MQTT implementation requires:

    1) an MQTT broker which runs on the server side. This could be something like the mosquitto broker which is Open Source.

    2) an MQTT client library which you include in your Android app, enabling your app to connect, subscribe, and publish messages. There are a number of Java options listed at http://mqtt.org/software

    3) to come up with a way of uniquely identifying users or devices, and then use that as a topic so that you can individually publish a message to one device. Dale Lane has written a nice guide on this (http://dalelane.co.uk/blog/?p=1599) and there is also a good set of resources about MQTT (https://github.com/mqtt/mqtt.github.io/wiki)

    Also the blog post Github sample below provides a practical example to implement MQTT push notification for Android:

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

    https://github.com/tokudu/AndroidPushNotificationsDemo

    0 讨论(0)
  • 2020-12-14 23:36

    Just prior to the quote you posted (about Google account not being required), you have this :

    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.

    Therefore it seems Google Play Store is a must for GCM to work.

    Pushy is an alternative to GCM that does not require a Google account nor Google Play Services.

    0 讨论(0)
提交回复
热议问题