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
New Developer
Posts: 12
Registered: ‎08-12-2013
My Device: Dev Alpha B
My Carrier: Fido

Blackberry Push SERVICE_NOT_AVAILABLE error

I have a ported Android app that uses GCM for push notifications. I followed steps here - https://developer.blackberry.com/android/apisupport/creating_push-enabled_android_apps.html

 

1. I requested "evaluation push api keys" here https://www.blackberry.com/profile/?eventId=8121

2. I created a MyAppName.cfg and put it in the root folder with the content in the following format:

 

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

where "myAppID" I put the app ID I got in the email.

3. I deploy the app using Eclipse. I also tried manually creating the .bar file (with the commnad line) and signing the app, I'm still not able to register with the Blackberry server and I get error "SERVICE_NOT_AVAILABLE" in the following IOException:

 

 

new AsyncTask<Void, Void, String>() {
            protected String doInBackground(Void... params) {
                String msg = "";
                try {
                    if (gcm == null) {
                        gcm = GoogleCloudMessaging.getInstance(context);
                    }
                    appId = gcm.register(SENDER_ID);
                    msg = "Device registered, registration id = " + appId;

                    // Save the appId - no need to register again.
                    setRegistrationId(context, appId);
                } catch (IOException ex) {
                    msg = "Error :" + ex.getMessage();
                }
                Log.i("GCM", msg + " id:" + appId);
                return msg;
            }

        }.execute(null, null, null);

 It also states "The Push Service requires that your signing keys have push capability enabled" so I was wondering how to check if my signing keys have push capability enabled or not?

 

I'm using Android Runtime 4.2.2 by the way and deploying it on a Dev Alpha B v10.2.0.341

New Developer
Posts: 12
Registered: ‎08-12-2013
My Device: Dev Alpha B
My Carrier: Fido

Re: Blackberry Push SERVICE_NOT_AVAILABLE error

I have read the other two posts on the forum and made sure I'm using new debug token and I do have the little blackberry icon beside the WiFi icon in the status bar. BBM works as well
Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Blackberry Push SERVICE_NOT_AVAILABLE error

Hi there,

 

Could you open the MANIFEST.MF file of your debug token (located in the /METAINF directory) and check the "Debug-Token-System-Actions" line? It should have "_sys_use_consumer_push" listed if this permission exists on your debug token. If it does not then you would need to delete this token then create a new token for the permission to be applied, renewing will not work.

Garett
@garettBeuk
--
Goodbye everybody!
New Developer
Posts: 12
Registered: ‎08-12-2013
My Device: Dev Alpha B
My Carrier: Fido

Re: Blackberry Push SERVICE_NOT_AVAILABLE error

I don't have "Debug-Token-System-Actions" line.. only Entry-Point-System-Actions: _sys_use_consumer_push in my MANIFEST.MF file... Do I need both permissions for the push notifications to work?

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

Re: Blackberry Push SERVICE_NOT_AVAILABLE error

Sounds like you may be opening the app's BAR file? I need you to open the debug token's BAR file, this article shows how to find the debug token:

http://supportforums.blackberry.com/t5/Testing-and-Deployment/Backup-and-Restore-BlackBerry-Code-Sig...

Garett
@garettBeuk
--
Goodbye everybody!
New Developer
Posts: 12
Registered: ‎08-12-2013
My Device: Dev Alpha B
My Carrier: Fido

Re: Blackberry Push SERVICE_NOT_AVAILABLE error

Thanks for your reply Garett.

Sorry, I got confused which bar to open. Actually, in the article debug tokens are not even mentioned. "This article explains how to backup and restore your BlackBerry® Code Signing Keys".

 

Anyways, I know where my debug token is by looking at Eclipse settings. I have the following line in MANIFEST.MF file:

Debug-Token-System-Actions: execute,multi_window,multi_instance,run_air_native,run_native,_sys_use_consumer_push

New Developer
Posts: 12
Registered: ‎08-12-2013
My Device: Dev Alpha B
My Carrier: Fido

Re: Blackberry Push SERVICE_NOT_AVAILABLE error

Also, I'm testing it on Dev Alpha B. Are push services available for it?
Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Blackberry Push SERVICE_NOT_AVAILABLE error

Sorry for the confusion, by default debug tokens are created in the same directory as code signing keys which is why I linked that article.

 

Could you try updating your OS?

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

 

Push services are available on the Dev Alpha B.

 

Also, can you provide the manifest with the list of intents used for push in your app?

 

 

Garett
@garettBeuk
--
Goodbye everybody!
New Developer
Posts: 12
Registered: ‎08-12-2013
My Device: Dev Alpha B
My Carrier: Fido

Re: Blackberry Push SERVICE_NOT_AVAILABLE error

I have updated the software on the device. Still getting the same error.

 

Here's the push receiver from manifest:

 

<receiver
            android:name="com.google.android.gcm.GCMBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>

                <!-- Receives the actual messages. -->
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <!-- Receives the registration id. -->
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

                <category android:name="com.utsc" />
            </intent-filter>
  </receiver>

<service android:name="com.utsc.GCMIntentService" />

 

New Developer
Posts: 12
Registered: ‎08-12-2013
My Device: Dev Alpha B
My Carrier: Fido

Re: Blackberry Push SERVICE_NOT_AVAILABLE error

And these are the permissions for GCM:

 

<!-- The following are for GCM -->
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

    <permission
        android:name="com.utsc.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.utsc.permission.C2D_MESSAGE" />