Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

BlackBerry Push Development

Reply
Highlighted
Developer
Posts: 20
Registered: ‎09-18-2013
My Device: Developer
My Carrier: Non-BlackBerry user

Android Runtime app with Push Service problem

Hello!
I'm having issues trying to port an Android app to BlackBerry 10, mainly because it uses Push Services. I been following the instructions in the web page Creating Push-Enabled Android Apps. I have my push credentials from BlackBerry, I created the android.cfg file and put it inside the .bar, I checked that the manifest file in the .bar had the permission Entry-Point-System-Action: _sys_uses_consumer_push, wich it had. And I also added to my project the stand-alone library GooglePlayServices.jar, since my Android app uses the new Google Cloud Messaging Service.

 

The problems arise when I try to register the push service with the GCM server. The log cat gives me this message:

 

java.io.IOException: SERVICE_NOT_AVAILABLE

at com.google.android.gms.gcm.GoogleCloudMessaging.register (Unkown source)

 

I believe the problem is that the Google Play Services Library it's not compatible yet with BlackBerry 10, as I have seen in other posts that the library the other developers use is gcm.jar(wich is deprecated).

 

I wanted to know if I could use the Google Play Services Library or if I had to change my project to the GCM library(wich include changing several pieces of code).

 

I also wanted to know if there was a way I could get the device PIN in an Android Runtime app. 

 

Thank you for your time

 

 

Developer
Posts: 20
Registered: ‎09-18-2013
My Device: Developer
My Carrier: Non-BlackBerry user

Re: Android Runtime app with Push Service problem

I changed the Google Play Service Library for the GCM, and it got a little better. But when I try to register with GCM it throws me the INVALID_SENDER error, so I still don't have the registration ID.

 

I'm using the SENDER_ID that I used in the Android version. According to a comment in StackOverflow (link), it's not a problem to use the same SENDER_ID with different Android apps, but since this is a BlackBerry App I'm not sure if it turns out to be a problem.

 

I also don't know if the SENDER_ID from Google is ignored and the app takes the appID provided by BlackBerry. It's that's the case, should I change the SENDER_ID variable? or is something else that I'm missing?

Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Android Runtime app with Push Service problem

Could you post the contents of your android.cfg file (please hide any account-specific values)?

Garett
@garettBeuk
--
Goodbye everybody!
Developer
Posts: 20
Registered: ‎09-18-2013
My Device: Developer
My Carrier: Non-BlackBerry user

Re: Android Runtime app with Push Service problem

Here it is:

 

<?xml version="1.0" encoding="utf-8"?>
<android>
<push>
<appid>688-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</appid>
<ppgurl>http://cp688.pushapi.eval.blackberry.com</ppgurl>
<tokenprefix>bb-</tokenprefix>
</push>
</android>

 

I'm realizing I had a mistake in the ppgurl, I'll fix it and let you know if it worked. Thank you!

Developer
Posts: 20
Registered: ‎09-18-2013
My Device: Developer
My Carrier: Non-BlackBerry user

Re: Android Runtime app with Push Service problem

I corrected the pggurl in the android.cfg file and I still get an empty registrationID, the error now states this: SERVICE_NOT_AVAILABLE
Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Android Runtime app with Push Service problem

Are you testing using a real device or simulator? What is the model and full OS version being used?

 

Have you removed all dependencies on the Google Play libraries?

Garett
@garettBeuk
--
Goodbye everybody!
Developer
Posts: 20
Registered: ‎09-18-2013
My Device: Developer
My Carrier: Non-BlackBerry user

Re: Android Runtime app with Push Service problem

I'm testing in a real device. It's a Dev Alpha with 10.1.0.1485 OS version.

And already checked that the dependencies from Google Play Services are all removed from the project.

 

Sorry for the delay in answering the las post, I've been busy with other projects, thank you for helping me out

Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Android Runtime app with Push Service problem

Hi,

 

May be worth updating your device to the latest OS:

https://developer.blackberry.com/blackberry10devalphas/update/

 

This will get you past any possibility of a bug causing this and clear the cache in the event the app is already registered on the device (lingering in the registry).

Garett
@garettBeuk
--
Goodbye everybody!
Developer
Posts: 20
Registered: ‎09-18-2013
My Device: Developer
My Carrier: Non-BlackBerry user

Re: Android Runtime app with Push Service problem

Hi again! I updated the OS of the device, and now it's saying 'INVALID SENDER' again. I don't know what else to do. I'll re-check for Google Play references, but I'm pretty sure I erased them all.