Android Wear 2.0是否有自己的GCM/FCM注册ID? [英] Does Android wear 2.0 has its own GCM/FCM Registration ID?

查看:72
本文介绍了Android Wear 2.0是否有自己的GCM/FCM注册ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为Android Wear 2.0公告的一部分,声明:

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).

问题是,这是否意味着Android Wear应用程序可以获取自己的GCM/FCM注册ID,并且根本不需要手机就可以直接向手表接收推送通知?这里有人可以用文档证明还是凭自己的经验证明? 如果我在设备和手表上有相同的应用程序,可以接收推送通知,该怎么办? 预先感谢.

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.

推荐答案

文档,该应用可以直接使用

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将通知发送到手表.

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

在Wear应用运行时,通过收集设备的注册令牌来提供来自FCM的消息.然后,当服务器将消息发送到FCM REST端点时,将令牌作为目标的一部分. FCM将消息发送到令牌标识的设备.

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.

FCM消息为JSON格式,可以包含以下有效载荷中的一个或两个:

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.

数据有效负载.有效负载具有一组自定义键/值对.有效负载并作为数据传递到您的Wear应用.

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

这篇关于Android Wear 2.0是否有自己的GCM/FCM注册ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆