03-21-2014 04:54 PM
I've ported a working Android app with working Android push notifications to BB10. I've followed the creating_push-enabled_android_apps guide and I'm still not getting any notifications on my BB10 device. Just in case I'm missing something obvious, can someone please just answer a simple simple question for me?
When I get this finally working, will it actually be a Google push (either C2DM or GCM) that initiates the notifications on my BB10 device, or do I need to rewrite everything for Blackberry Push? I'd prefer to keep using Google push and it appears that might be a possibility, but I'm skeptical that C2DM would work on a Blackberry device since it requires a Google account and Google Play in order to work (at least that was listed as a requirement back when I first learned about C2DM).
Solved! Go to Solution.
03-24-2014 09:49 AM
You would need to push through the BlackBerry servers, the Google servers will not be able to deliver those messages to the BlackBerry devices.
If the above does not resolve the issue could you please provide some details on what you have done and what is being tested so far?
03-25-2014 08:37 PM - edited 03-25-2014 08:38 PM
Here are the continuing points of confusion:
In the "Creating Push-Enabled Android Apps" tutorial it says to do a step and then at the end says "and will allow your Android app to work without changing any code or compiling again. " Nowhere does it talk about doing all of the coding for changing the registration of the device (which in Android registers to the GCM/C2DM mothership to get a Registration ID). Is there boilerplate code for this? Do I need to add some code in Eclipse that pulls the PIN from the device? Wouldn't that require adding a Blackberry library of some sort to the project?
03-26-2014 07:44 AM
There are no device-side code changes required, the android.cfg file will tell the runtime to register your app against the BlackBerry servers as opposed to the GCM/C2DM servers.
As for the server-side, we offer a full Java SDK for sending push messages to BlackBerry devices here:
In its simplest form the server code sends an XML formatted HTTP POST to the BlackBerry servers. The following doc provides examples of the PAP templates used by the service if you'd like to write your own implementation:
03-26-2014 10:48 AM
The device needs to tell our notification server its unique ID so that when a push notification needs to be sent, the server knows who to send it to. In Google Push, the device registers with Google, gets a unique ID back, and we have the device upload this value to our servers so we can identify it later for Push purposes.
Where in our Android code does this piece happen? The documentation mentions placing a prefix ("bb-" for example) in front of the registration ID, but where does the Android code get this registration ID? Does the device still register with Google Servers to get a reg ID even though it's a Blackberry device? The documentation mentions that a particular flavor of GCM works, but we're still using C2DM.
03-26-2014 10:52 AM
The device does not talk to the Google servers at all. The registration ID is handled within the client, your app, the same way when run on BlackBerry.
The 'bb-' prefix is specified in the android.cfg file, this value can really be set to whatever you like. The registration ID will be passed to your app with the aforementioned value prefixed. Your server can determine whether it is an Android or BlackBerry registration by checking for the prefix value, then it can determine whether to push through GCM or the BlackBerry servers accordingly.
03-26-2014 10:58 AM
There seems to be a conflict between "no code needs to be changed in the Android project" and "the app now uses a Blackberry ID instead of a Google ID".
How do I get the Blackberry ID?
Without changing my code how am I supposed to upload this ID to my server?
Why is a prefix needed if it's an 8 digit Blackberry ID which is clearly different from the very long Google registration ID?
03-26-2014 11:22 AM
There's no conflict, but perhaps I'm not being clear. It also has *nothing* to do with BBID, not sure where that even came in.
You retrieve the BlackBerry registration ID, which is a PIN, as opposed to the Google registration ID, whatever that is.
The prefix is meant to make the differentiation easier, the address used by BlackBerry may not always be the PIN (not saying there are plans to change it, but it could perceivably happen).
The ID would be uploaded to your server the same way the Google ID would be, your server could use the prefix to determine what kind of device is being registered.