Polymer - Platinum Push Messaging

用于使用 <platinum-push-messaging> 定义接收到的推送消息元素,可以放置在任何位置,但在一个页面中只需使用一次。

您可以在应用程序中使用此元素,方法是运行以下命令将其安装在项目目录中。

bower install --save PolymerElements/platinum-push-messaging

推送消息订阅仅在 Google Chrome 中可用,它需要 Google Cloud Messaging 配置,Chrome 使用清单文件中的 gcm_sender_id 字段来链接页面。

通知详细信息

通知消息可以通过三种方式显示 −

使用第一种方式,您可以通过指定 URL 来获取通知消息。

<platinum-push-messaging
message-url = "message_notification.json">
</platinum-push-messaging>

使用第二种方式,您可以从服务器发送正文中的通知消息。

<platinum-push-messaging></platinum-push-messaging>

使用第三种方式,您可以在元素上手动指定属性。

<platinum-push-messaging 
   title = "Message Application"
   message = "Your application data is updated in the background"
   icon-url = "icon.png"
   click-url = "message_notification.html">
</platinum-push-messaging>

如果您使用的是 Google Cloud Messaging 服务,则可以将推送消息发送到浏览器。按照此链接中给出的说明,在服务器和客户端应用程序之间发送消息。

polymer_elements.html