0
votes

I have downloaded the sample application for Push Notification Module, and tried to run it on a Samsung Tab 2. I discovered that it requires senderId and Key so I created these values using Google's GCM Console. Then, I ran app and it was successful. I then subscribed through the sample app and pressed on the Login button. After Login my LogCat shows the following:

03-14 13:03:10.648: V/GCMRegistrar(9351): Saving regId on app version 1 03-14 13:03:10.648: D/WLDroidGap(9351): Registered at the GCM server with registration id APA91bEUF25J1woHwcfEhG-73XXUyRJw6ul26VF0GQJBJQ9gtgjg0QK5gQ9Nq2sAeHiOKCJGRlJJvZ_0CvibjwS_eg9IUkHKez9zVxbgCtPsWj85DuHv6JbzydQY182-HvkbfM45lGG8cF_ndknxnG8XpyaZnh55eQ

03-14 13:03:10.671: D/WLDroidGap(9351): Notifying javascript on successful registration

03-14 13:03:10.679: D/PushApplication(9351): Push notification device token has changed, updating server notification token id.

03-14 13:03:10.687: D/PushApplication(9351): Request [http://192.168.1.206:8080/apps/services/api/PushApplication/android/notifications]

03-14 13:03:10.710: D/PushApplication(9351): response [http://192.168.1.206:8080/apps/services/api/PushApplication/android/notifications] success: /*-secure-

03-14 13:03:10.710: D/PushApplication(9351): {"errors":[],"isSuccessful":true,"warnings":[],"info":[]}*/

03-14 13:03:12.914: D/PushApplication(9351): Request [http://192.168.1.206:8080/apps/services/api/PushApplication/android/notifications]

03-14 13:03:12.929: D/WLDroidGap(9351): Javascript script requests dispatching to WL.Client.Push.__onmessage

03-14 13:03:52.625: D/PushApplication(9351): Request [login]

03-14 13:03:52.695: D/PushApplication(9351): Request [http://192.168.1.206:8080/apps/services/api/PushApplication/android/notifications]

03-14 13:03:52.750: D/PushApplication(9351): response [http://192.168.1.206:8080/apps/services/api/PushApplication/android/notifications] success: /*-secure-

03-14 13:03:52.750: D/PushApplication(9351): {"isSuccessful":true,"WL-Authentication-Success":{"PushAppRealm":{"userId":"[email protected]","attributes":{},"isUserAuthenticated":1,"displayName":"[email protected]"}}}*/

then after some time my Log cat shows:

unregisterReceivers:Receiver not registered: com.worklight.androidgap.plugin.Push$1@4128e920

and this error on web console:

{"WL-Authentication-Success":{"wl_deviceNoProvisioningRealm":{"userId":"device","attributes":{"mobileClientData":"com.worklight.core.auth.impl.MobileClientData@e0d191"},"isUserAuthenticated":1,"displayName":"device"}},,"WL-Authentication-Failure":{"wl_remoteDisableRealm":{"reason":"Login Failed"}}}*/

Next after login and subscribing it does not show anything that will allow me to know whether the notification was successfully pushed.

1

1 Answers

1
votes

The flow is wrong. You can't subscribe before logging it to the application. You first log in, and then you click on the subscribe button which should display a pop-up saying subscription was successful. You can then click on the isPushSupported and isSubscribed buttons to verify this.

Sending a notification afterwards should then succeed as well.

Google may on its own to unregister users that have not received push notifications for a while (it does not reveal after how long it has done that), perhaps that caused your issue. You did not specify clear enough reproduction steps.