0
votes

I run Push Notification Sample code on Worklight server and its working. Now i want to send notification from one device to another device so what are the required changes in the adapter?

The adapter XML:

<displayName>PushAdapter</displayName>
<description>PushAdapter</description>
<connectivity>
    <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
        <protocol>http</protocol>
        <domain>https://android.apis.google.com</domain>
        <port>8080</port>           
    </connectionPolicy>
    <loadConstraints maxConcurrentConnectionsPerNode="2"/>
</connectivity>

Should i change domain and port and i have to upload the app first on google play so that i can able to recive or send notifications. And should i create a key for android device on GCM

1

1 Answers

2
votes

Push notifications in Worklight (and I believe at large as well) are not sent from one device to another per-se; consider it this way:

You have two applications:

  • A managing app
  • A receiving app

User A is running the managing app - this application is able to send a request to the server, which tells it to send a notification to some other user(s).

User B is running the receiving app - this application is able to receive notifications.

  • All of this is not related at all to the Google Play store.
  • Yes, both apps will require a GCM senderId and Key values in order to have any Push Notification capabilities.

As for implementing all of this... there is no sample to do this, but you already have part of the solution (the sample app is able to receive notifications). What you need to do now is have the managing application be able to retrieve a list of / specific username(s), and create a procedure that will invoke a function to send the notification based on the username(s) you have retrieved.