- 注册小米推送
- 注册成功时获取的内容
- 收到消息时获取的内容
- 点击消息时获取的内容
- 设置 Alias
- 注销 Alias
- 设置 userAccount
- 注销 userAccount
- 订阅 Topic
- 取消 Topic
用于小米注册,在 deviceready 事件触发时调用
window.plugins.MiPushPlugin.init()
- regId: window.plugins.MiPushPlugin.receiveRegisterResult.regId
在自己的js代码中注册 mipush.receiveRegisterResult 事件(可以参考sample中的index.js)
document.addEventListener("mipush.receiveRegisterResult", Your_Receive_Register_Function, false);
Your_Receive_Register_Function(data)
-
data(json字符串)
regId = data.regId
- title(标题): window.plugins.MiPushPlugin.notificationMessageArrived.title
- description(消息摘要): window.plugins.MiPushPlugin.notificationMessageArrived.description
- your_key(附加字段,一般由后台定义): window.plugins.MiPushPlugin.notificationMessageArrived.your_key
在自己的js代码中注册 mipush.notificationMessageArrived 事件(可以参考sample中的index.js)
document.addEventListener("mipush.notificationMessageArrived", Your_Notification_Message_Arrived_Function, false);
Your_Notification_Message_Arrived_Function(data)
-
data(json字符串)
title = data.title description = data.description your_key = data.your_key
- title(标题): window.plugins.MiPushPlugin.notificationMessageClicked.title
- description(消息摘要): window.plugins.MiPushPlugin.notificationMessageClicked.description
- your_key(附加字段,一般由后台定义): window.plugins.MiPushPlugin.notificationMessageClicked.your_key
在自己的js代码中注册 mipush.notificationMessageClicked 事件(可以参考sample中的index.js)
document.addEventListener("mipush.notificationMessageClicked", Your_Notification_Message_Clicked_Function, false);
Your_Notification_Message_Clicked_Function(data)
-
data(json字符串)
title = data.title description = data.description your_key = data.your_key
window.plugins.MiPushPlugin.setAlias(alias)
- alias: 设置Alias的值(字符串)
window.plugins.MiPushPlugin.unSetAlias(alias)
- alias: 注销Alias的值(字符串)
window.plugins.MiPushPlugin.setUserAccount(userAccount)
- userAccount: 设置userAccount的值(字符串)
window.plugins.MiPushPlugin.unSetUserAccount(userAccount)
- userAccount: 注销userAccount的值(字符串)
window.plugins.MiPushPlugin.setTopic(topic)
- topic: 订阅Topic的值(字符串)
window.plugins.MiPushPlugin.unSetTopic(topic)
- topic: 取消Topic的值(字符串)