Does anyone know if there is a Java client framework / API to call Windows phone push notification service? I know there is a JavaPNS project, which is specific to Apple PNS. I am looking for something similar to that, but specific to Windows phone.
Any help?
I've developed a solution with Spring and Apache Commons HTTP Client for sending RAW messages using WNS (Windows Notification Push Service)
Insert this dependencies on your pom.xml:
And the following lines on applicationContext.xml
*Remember to fill client_id and client_secret
In my project, I've divided the implementation in four classes, which I'm going to describe below
OAuthToken is used to store and format the access token:
The HttpClientFactory (shown bellow) is used to create a new client whenever you send a message. If you reuse the same HttpClient to send a message, WNS time-out after the second message sent. I don't know why that happens, but it solved when I stopped reusing the client.
This is a base class, as you wish, you can pull down all code to WindowsPushNotificationMediator
The next class should do the main work, but remember to create a
cloudMessagingDAO
to retrieve and store your access token. You should replace the classJogador
for another class that contains the client URL, used to send a message to a Windows Phone device.Java-mpns seems to be close to what you are looking for.
https://github.com/notnoop/java-mpns