I am new to IBM Worklight and I am trying to get push notification to work on my Android device.
I have followed the "Push notification in hybrid applications" tutorial on their website and imported the sample project.
The problem is somehow I didn't receive the push notification in my android device (haven't tried any other device yet). I didn't see any error in the console and it reported that the notifications has been sent to user.
Here is the log :
[2014-07-18 12:44:32] Starting procedure invocation on Worklight Server
[2014-07-18 12:44:33] Not deploying adapter 'PushAdapter' since it was not changed since last deployment
[2014-07-18 12:44:33] Invoking procedure: 'submitNotification' of adapter 'PushAdapter'
[2014-07-18 12:44:33] Server host: 192.168.1.100
[2014-07-18 12:44:33] Server port: 10080
[2014-07-18 12:44:33] Parameters: ["david","test message"]
[2014-07-18 12:44:33] Procedure invocation finished
And this is the report body:
{
"isSuccessful": true,
"result": "Notification sent to user :: david"
}
But I wait and wait and wait... and the notification still not arrived...
What I have done :
- Read many SO question relevant to this topic like this and this (but still no luck)
- Install Google Cloud Messaging Library for Android, although it has already obsolete, and Google Play services :
- Generate API credential in google console (tried both browser key and android key)
- Set key on application-descriptor.xml
- Enable Google Cloud Messaging for Android and Google Play Android Developer API in google console project
- turn off firewall
- add google service lib as project reference
And i ran out of idea..
It seems my worklight console also didn't receive the push notification :
it shows 0 new messages and 0 total messages..
please help me.. i am losing hope.. any help would be very appreciated :) thanks in advance
Push Notifications in Worklight work for me when following the below instructions:
Used my GCM ID and GCM Key in application-descriptor.xml
Created an AVD using the Google API (not to be confused with Android 4.4.2 level 19)
Right-click on the generated Android project > Run As > Android application
The AVD launches, application is installed
'Idan','test notification'
and clicked on the OK buttonIn the device, the alert()s from the application's JavaScript start popping, indicating the notification was received.
The above was tested in my home network, so I would suggest to double-check that you followed the above as well as check again your network settings. Take a look at slide #53 in the Push Notifications training module.