03-26-2014 01:09 PM
For Google Push the device sends a registration request to the Google Server and a very long registration ID is returned. This ID is mentioned in the Blackberry document on how to port push-enabled Android apps.
This registration ID needs to be saved to our servers so we know who to ask the Apple/Google/Blackberry push services to push to.
Since the ported app will not talk to Google Servers, the step where the app gets the unique ID of the device that it's on so that this ID can be uploaded to our servers for future Push information seems like it needs to be changed in the code.
03-26-2014 01:14 PM
The app will retrieve a similar ID from the BlackBerry servers, the app itself will not be able to know which server it is working with.
Does your client app retrieve the registration ID when run on Android devices? If so the same code should retrieve the BlackBerry device ID (token) when run on a BlackBerry device.
This post shows the code:
03-26-2014 01:30 PM
Yes, my Android client app retrieves a registration ID when using Google Push. It asks for the ID from the Google servers. Without a code change, it will continue to request an ID from Google servers. I debugged it yesterday and not surprisingly this ID was null on a Blackberry device (because it was asking Google for an ID for a Blackberry device).
In the post you referenced, "The device PIN is returned as a token in the GCM intent listener when registration has been completed. It can be retrieved from the intent using the following code:
final String token = intent.getStringExtra("registration_id");" implies that the Blackberry device still asks Google for a registration ID. A GCM intent listener talks to Google and Google returns the ID.
An Android app using Google push does the following things:
1. Fires up for the first time.
2. Asks Google C2DM/GCM for a registration ID.
3. Receives the registration ID so it can be uploaded to our servers for push reference.
When porting an Android app to Blackberry, you're saying that I don't need to do step 2 and instead need to get a Blackberry ID of some sort (the 8 digit one?). But that would require a code change, which I thought wasn't necessary.
03-26-2014 01:39 PM
The BlackBerry Runtime for Android apps takes the call to the Google servers and replaces it with a call to the BlackBerry servers to receive a similar registration ID.
App ==> Runtime ==> Google Servers (registration ID gathered)
Google Servers ==> Runtime ==> App
BlackBerry device running *same* app but with an android.cfg file added and proper permissions for push:
App ==> Runtime ==> BlackBerry servers (registration ID gathered)
BlackBerry servers ==> Runtime ==> App
The app has no idea what back-end server it is talking to, this is handled by the lib/runtime.
If a value is null it does not mean that the call to the Google Servers did not work, as mentioned above the app will not talk to the Google Servers for registration. It could be an issue with how the app is configured, but the concept that Google Servers are not involved and that the runtime handles the redirect to the BlackBerry servers needs to be understood before we can move forward with any sort of troubleshooting.
03-26-2014 03:13 PM - edited 03-26-2014 03:43 PM
I now understand that Google servers no longer provide registration IDs. I'm not grasping the piece where the old code (which used to ask Google for the info) now automatically asks BlackBerry instead. Is it An actual network call or does it just query the service internally? Should I expect to see a BlackBerry ID in the point of my code where it previously returned a Google ID?
03-27-2014 08:02 AM
The actual code that makes server calls is abstracted, it's not something you, as a developer, actually code.
You should expect to receive a BlackBerry token/device address when using the chunk of code I referenced earlier.
04-30-2014 04:02 PM
I'm finally getting a chance to implement this after paternity leave and so far so bad.
I've followed the instructions exactly, but when I debug on the device via Eclipse, the value of "token" at the line below is null.
final String token = intent.getStringExtra("registration_id");
Anything else I could be missing?
04-30-2014 04:19 PM
I am seeing "INVALID_SENDER" in the same area of code, though. I think I've seen this in my research on this so I will search for that while I wait to hear back from a badly-needed helpful person. Thanks!