Does Android wear 2.0 has its own GCM/FCM Registration ID?

ε祈祈猫儿з 提交于 2019-12-10 11:41:01

问题


As a part of announcement of Android Wear 2.0 there was declared:

Standalone applications: direct network access to cloud (apps run on watch even when your phone isn't with you).

The question is does this means that android wear application can get its own GCM/FCM registration ID and receive push notifications directly to the watch without phone at all? Can someone here prove it with documentation or on its own experience? What happen if I have same applications on the device and watch, that receives push notifications? Thanks in advance.


回答1:


It is stated in the documentation of Android wear 2.0 under the Cloud Messaging that for sending notifications, apps can directly use Firebase Cloud Messaging (FCM). Note that FCM is supported on Wear 2.0. and GCM is not supported.

Here are the other details that you can find in this documentation.

FCM is the recommended way to send notifications to a watch.

Provide for messages from FCM by collecting a registration token for a device when your Wear app runs. Then include the token as part of the destination when your server sends messages to the FCM REST endpoint. FCM sends messages to the device identified by the token.

An FCM message is in JSON format and can include one or both of the following payloads:

  • Notification payload. When a notification payload is received by a watch, the data is displayed to a user directly in the notification stream. When the user taps the notification, your app is launched.

  • Data payload. The payload has a set of custom key/value pairs. The payload and is delivered as data to your Wear app.



来源:https://stackoverflow.com/questions/42185400/does-android-wear-2-0-has-its-own-gcm-fcm-registration-id

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!