![](/img/trans.png)
[英]How can i check push notification permission for both ios and android in react native?
[英]Quickblox - How can I push notification to both platform Android and iOS?
如果要向所有平台發送推送,則無需傳遞推送類型參數
解決方案N1(僅文本):
QBEvent event = new QBEvent();
event.setUserIds(userIds);
event.setType(QBEventType.ONE_SHOT);
event.setEnvironment(QBEnvironment.DEVELOPMENT);
event.setNotificationType(QBNotificationType.PUSH);
//
event.setMessage("This is simple generic push notification!");
解決方案N2(帶有自定義參數):
QBEvent event = new QBEvent();
event.setUserIds(userIds);
event.setType(QBEventType.ONE_SHOT);
event.setEnvironment(QBEnvironment.DEVELOPMENT);
event.setNotificationType(QBNotificationType.PUSH);
//
// generic push with custom parameters - http://quickblox.com/developers/Messages#Use_custom_parameters
JSONObject json = new JSONObject();
try {
json.put("message", "This is generic push notification with custom params!");
json.put("param1", "value1");
json.put("ios_badge", "4"); // iOS badge value
} catch (Exception e) {
e.printStackTrace();
}
event.setMessage(json.toString());
以及文檔http://quickblox.com/developers/SimpleSample-messages_users-android#Universal_push_notifications
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.