IBM Worklight and push notifications issue - android

I've deployed an Android application on a real device using IBM Worklight.
I've enabled the push notifications and all works on the Android emulator, but on the real device I see this popup:
Failed registering for push notifications. The application will not be
able to receive notifications.
And in LogCat, this message:
Push notification will not work, because register/unregister to GCM
service returned error AUTHENTICATION_ERROR
On the android device the same gmail account of the senderId is syncronized.
My Environment:
Worklight Studio 5.0.6
Eclipse Java EE IDE for Web Developers. Version: Juno Service Release 1 Build id: 20120920-0800
Windows7
Android 2.3
I've checked the behavior with:
Android 4.2 Smartphone
Android 4.1 Smartphone
Android 3.1 Tablet
Android 2.3 Smartphone
I'm not able to subscribe the application for push notifications only with the 2.3 Android version.

Push Notifications in Worklight with the Android environments are supported starting Android OS 2.2 and above (2.2.x, 2.3.x and 4.x.x. Worklight does not support Android OS 3, but it should work there with Worklight none the less).
From another SO question: HTTP Status Code: 401 in GCMDemo
Authentication ErrorThe sender account that you're trying to use to
send a message couldn't be authenticated. Possible causes are:
Authorization header missing or with invalid syntax.
Invalid project number sent as key.
Key valid but with GCM service disabled.
Request originated from a server not whitelisted in the Server Key
IPs.
I would re-validate all required settings, in this case: Gmail address and password in the device, and senderId and Key in application-descriptor.xml

Related

IBM MobileFirst 8 - Push Notification errorCode: invalid_client

I am getting the following error while registering the device for push notification in android,
Failed to register
device:"com.ibm.mobilefirstplatform.clientsdk.android.push.api.MFPPushException:
Response: Status=400, Text:
{\"errorCode\":\"invalid_client\",\"errorMsg\":\"Incorrect JWT
format\"}, Error Message: Incorrect JWT format"
MFP Server: 8.0.0.00-20170220-1900
Cordova : 6.1.1
cordova-plugin-mfp : 8.0.201703309
cordova-plugin-mfp-push: 8.0.2017012410
Found the similar question but no clear figure :
IBM MobileFirst v8 trying to obtain Token on android cordova app after successful login challenge handler
Cordova Android application getting "invalid_client" from Mobile First 8.0 server
Any solution or suggestion will be appreciable.
Looks like you are missing the step in the android platform. In Android Studio, add the following activity to the application tag:
<activity android:name="com.ibm.mobilefirstplatform.clientsdk.android.push.api.MFPPushNotificationHandler" android:theme="#android:style/Theme.NoDisplay"/>
The most common cause of the issue is failure in time synchronization between client and server. Verify if the server time if offset from the client. Specifically if the server has a time in past.
I had the same issue, Rebooting the client device / emulator helped me.
( The the "check server time" was not practical for me, my Server runs as Bluemix service in US )
BTW: I can reproduce this "Incorrect JWT format" in the android emulator: If the android emulator is running overnight and I try the next day, I always get this error (until restarting the emulator)

Meteor raix:push: Android Client no longer registering after upgrade

After upgrading from raix:push 2.6.12 to 3.0.0 my Push notifications stopped working on Android.
When I run my app in a browser, the logging (with Push.debug=true) shows:
Push: Settings userId "qwertyuiopasdfghj" for app: mnbvcxzlkjhgfdsap
When I run my app on Android no such message is shown.
In both cases (logged in on Android or in Browser) when I Push.send I get:
Push: Send message "blablabla" via query { userId: 'qwertyuiopasdfghj' }
Push: Sent message "blablabla" to 0 ios apps 0 android apps
Push, GUIDE: The "Push.appCollection" is empty - No clients have registred on the server yet...
This is intended when logged in on the browser, but not when logged in via the Android app.
The upgrade to Push 3.0.0 included an upgrade from Meteor 1.1 to 1.2 and the inclusion of Crosswalk. Removing Crosswalk didn't help.
What keeps my Android client from registering?

IBM Worklight - Android push notification sent but not received

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:
Installed Worklight Studio v6.2 from the Eclipse Marketplace
Downloaded and imported the Push Notifications sample project
Used my GCM ID and GCM Key in application-descriptor.xml
The GCM ID is the "project number". You can find it once logging into the GCM Console and into the project you create
The GCM Key is the "Browser" key you create in your GCM project under Credentials > Create key
Setup the Android SDK with Google API level 19 & Google Play Services
Created an AVD using the Google API (not to be confused with Android 4.4.2 level 19)
This is especially important: when testing in the Android Emulator you need to use the Google API and not the Android API
When testing in a physica device, you can use the Android API
Right-click on the adapter folder > Run As > Deploy Worklight Adapter
Right-click on the application folder > Run As > Run on Worklight Development Server
Right-click on the generated Android project > Run As > Android application
The AVD launches, application is installed
Logged-in with "Idan"
Right-click on the adapter folder > Invoke Worklight Adapter
Entered 'Idan','test notification' and clicked on the OK button
In 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.

Push notifications with Worklight 5.0.1.299

I'm trying to add push notifications GCM to my app but I can't get the sample project to work.
This is what I did:
+Registered project id and API key at Google
+Entered id and key in application-descriptor.xml like so:
< pushSender key="XXX"senderId="YYY">
+Deployed adapter
+Built the app ("Build all and deploy", Android SDK API 18, Google API 18)
And I have read http://www.ibm.com/developerworks/mobile/worklight/getting-started.html
Push notifications
Please tell me why? I can't write < pushSender key="XXX" senderId="YYY">
It is error but when I write < pushSender id="XXX" password="YYY"> It is ok.
I try to fill ID with SENDERID and PASSWORD WITH KEY but error when I run android amulator
This is invalid: <pushSender id="XXX" password="YYY">
This is valid: <pushSender key="XXX" senderId="YYY"/>
From what you are writing, the second option does pass the build, but fails in the Android Emulator; it likely fails for you because you did not properly configure the Android project for push notifications when tested in the Android Emulator - this is especially important as the configuration differs between device and emulator.
It'd help if you would've mentioned the error you're talking about...
You can follow full instructions in these question:
IBM Worklight - Push Notifications feature does not work in Android emulator
IBM Worklight 5.0.6.1 - Android notification does not reach either device or emulator

IBM Worklight 5.0.6 - Push notifications error: "Error while trying to retrieve device token from the mobile operating system"

I'm trying to add push notifications to my app but I can't get the sample project to work.
This is what I did:
Downloaded sample project
Opened in Worklight 5.0.6
Registered project id and API key at Google
Entered id and key in application-descriptor.xml like so:
<pushSender key="XXX senderId="YYY"/>
Deployed adapter
Built the app ("Build all and deploy", Android SDK API 18, Google API 18)
Checked worklight console's Push Notifications tab (app and adapter are listed there) and the push notification tab
Started the app in android emulator (4.3)
In sample app, logged in with user "spyro", password "test"
Got an error:
Failed registering for push notifications. The application will not
be able to receive notifications
LogCat gives me the following messages:
10-22 06:07:11.178: E/SQLiteLog(2600): (14) cannot open file at line
30191 of [00bb9c9ce4] 10-22 06:07:11.178: E/SQLiteLog(2600): (14)
os_unix.c:30191: (2) open(/CachedGeoposition.db) - 10-22
06:10:58.392: W/WLDroidGap(2600): unregisterReceivers:Receiver not
registered: com.worklight.androidgap.plugin.Push$1#b419ff38 10-22
06:10:58.402: W/WLDroidGap(2600): unregisterReceivers:Receiver not
registered: com.worklight.androidgap.plugin.Push$3#b41a0458 10-22
06:10:58.442: E/PushApplication(2600): Error while trying to retrieve
device token from the mobile operating system.
I believe the following will resolve your problem, which is setting up push notifications in the Android Emulator; to have push notifications in the emulator it is required to install from the Android SDK Manager some support libraries.
First, make sure that you have followed all steps described in the Push Notifications training module, specifically slides 41 and 47.
Follow the steps described in the answer to this SO question:
IBM Worklight - Push Notifications feature does not work in Android emulator -- you must install the Google Cloud Messaging for Android Library (available in the Extras category)
In your updated question you do not mention whether you've installed the push notifications feature library, and you must install it.

Categories

Resources