简体   繁体   中英

Worklight Push Notification for multiple user

我在IBM的Worklight中创建了一个Push Notification应用程序,该应用程序仅向一个用户的设备(Android Device)发送通知。如何向多个用户的设备发送Push通知?如果创建了一个应用程序,请提供一些示例。

Worklight server must know user's identity in order to be able to send push notifications. In case you did not define any user authentication in your application, Worklight server will use an "anonymous" user identity - a persistent cookie created on first application launch. This is considered an unauthenticated access. In case this is the model you want to use you need to declare an EventSource in your adapter which does not require authentication (do not specify securityTest for it) and then use WL.Server.notifyAll(eventSource, options) API. This will send notification to users that are subscribed to a specified event source.

Source: http://www.ibm.com/developerworks/forums/thread.jspa?threadID=462167&tstart=360

Push notification works on Android and iOS only. You can see how to implement on iOS in the push notifications module. You can find the module at https://www.ibm.com/developerworks/mobile/worklight/getting-started/index.html#advanced

What I did to accomplish this is to save in a backend database all the users subscribed to a specific event source then send notifications to each of them.

I checked the Worklight info center and WL.Server.notifyAll(eventSource, options) api is not listed!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM