Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
6 replies Latest Post - ‏2012-11-26T08:06:47Z by AntonAleksandrov
ManojKushwaha
ManojKushwaha
23 Posts
ACCEPTED ANSWER

Pinned topic Push Notification for different users

‏2012-11-20T05:20:31Z |
Hi,
I have implemented push notification as per the sample provided in WL's tutorial.But it is sending Notification for only one user ID.I want to send push notification for multiple users in multiple devices.How it will be accomplish?
  • IdanAdar
    IdanAdar
    741 Posts
    ACCEPTED ANSWER

    Re: Push Notification for different users

    ‏2012-11-20T06:02:06Z  in response to ManojKushwaha
    There are many ways to accomplish this.
    • You could "broadcast" the notifications - go over the list of all subscribed users and send the notification to all of them
    • You could implement push without a username required

    It really depends on what you want to accomplish in your application. It is scenario-dependent.

    Idan Adar
    QA Engineer
    IBM Worklight Mobile Platform
    • ManojKushwaha
      ManojKushwaha
      23 Posts
      ACCEPTED ANSWER

      Re: Push Notification for different users

      ‏2012-11-20T06:13:10Z  in response to IdanAdar
      Hi Idan,

      thanks for your reply.Could you explore in some detail how to send without username or how to broadcast to all subscribed users?
      • ManojKushwaha
        ManojKushwaha
        23 Posts
        ACCEPTED ANSWER

        Re: Push Notification for different users

        ‏2012-11-21T10:28:29Z  in response to ManojKushwaha
        Hi,

        I am still waiting for the answer of this forum.plz anybody give any suggestion regarding this.I am using Worklight's Developer edition,and Push notification testing in Android Device.
  • IdanAdar
    IdanAdar
    741 Posts
    ACCEPTED ANSWER

    Re: Push Notification for different users

    ‏2012-11-22T12:10:02Z  in response to ManojKushwaha
    So the ability to broadcast is not currently available.

    What can you do perhaps is use the method WL.Server.notifyAllDevices, which notifies all devices of the given user.
    You could perhaps loop through your users and deliver the notification in that way.

    Idan Adar
    QA Engineer
    IBM Worklight Mobile Platform
    • ManojKushwaha
      ManojKushwaha
      23 Posts
      ACCEPTED ANSWER

      Re: Push Notification for different users

      ‏2012-11-22T14:09:00Z  in response to IdanAdar
      Hi Idan,
      you replied in your last post :

      1. You could "broadcast" the notifications - go over the list of all subscribed users and send the notification to all of them
      2. You could implement push without a username required
      Now you are saying "So the ability to broadcast is not currently available."

      How we can implement it without username.
      • AntonAleksandrov
        AntonAleksandrov
        55 Posts
        ACCEPTED ANSWER

        Re: Push Notification for different users

        ‏2012-11-26T08:06:47Z  in response to ManojKushwaha
        Hello,

        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.