Google 云消息传递 - Android 应用程序

Google Cloud Messaging - Android Application

我有一个网页,我想在网络上发生某些操作时向我的 Android 应用程序发送消息或提醒。我可以用 GCM 做吗?

是的,但它已被 Firebase 云消息传递 (FCM) 取代。请参阅 Firebase documentation

Firebase Cloud Messaging (FCM) is the new version of GCM. It inherits the reliable and scalable GCM infrastructure, plus new features! See the FAQ to learn more. If you are integrating messaging in a new app, start with FCM. GCM users are strongly recommended to upgrade to FCM, in order to benefit from new FCM features today and in the future.

除了 FCM 答案之外,如果您不使用 Firebase 作为后端,则可以实现自己的交互。 您需要:

  1. 在网络上注册设备(我们的应用程序应与 GCM 平台交互并收到一个 ID)
  2. 在您自己的后端注册设备(您的应用应与您的后端交互并保存设备 ID 和 GCM ID)
  3. 从您的后端实现与 GCM 平台的通信(使用 GCM id 将消息发送到由其 id 标识的设备)

希望对您有所帮助。