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

Android™ Runtime Development

Reply
New Contributor
MuhammadRashid
Posts: 6
Registered: ‎02-26-2013
My Device: Blackberry 10
My Carrier: 923214917948
Accepted Solution

Creating Push-Enabled Android Apps

Dear all,

 

I would like to say that i am new to Android Runtime. I have an android appliaction to port Blackberry 10. To support Push Message Services for Blackberry, I am currently unable to achieve it. My Android App supporst Google Cloud Messaging Service.

 

I am trying to follow step by setp instructions but things are not making well.

I read following link very carefully and already REGISTERED to EVALUATE the PUSH SERVICE.

https://developer.blackberry.com/android/apisupport/creating_push-enabled_android_apps.html

 

But i am facing issues on configure properties like;

 

http://cpXXX.pushapi.eval.blackberry.com

 

1. What should be cpXXX in android.cfg file?

2. How to use Push Port?

3. After you register with the Push Service, you need to create a configuration file (the android.cfg file), which

    YES I HAVE CREATED andriod.cfg file.

provides the BlackBerry Push configuration and will allow your Android app to work without changing any code or

 

compiling again.

 UNDERSTOOD

Using any .zip utility, add the android.cfg file to the .bar file. You should do this before you sign the .bar package.

How it possible to do this before sign. As bar file only generated after signing?

 

I really appreciate if anyone can provide working sample for Client.

 

Regards

Please use plain text.
New Contributor
sohayb1987
Posts: 2
Registered: ‎03-11-2013
My Device: BlackBerry Z10
My Carrier: Alfa Telecom

Re: Creating Push-Enabled Android Apps

Hello,
1- the XXX in clxxx should be replaced by the CPID you received when you registered for push : CPID (Content Provider ID): xxx
2-create the .cfg file and name it as your project name, drop it in the root directory of your project in eclipse then debug again, then you'll see an android.cfg in the generated bar file without using any zip utility.

Regards
Please use plain text.
New Contributor
MuhammadRashid
Posts: 6
Registered: ‎02-26-2013
My Device: Blackberry 10
My Carrier: 923214917948

Re: Creating Push-Enabled Android Apps

Thank you very much for response. 

 

Unfortunately  i am not able to produce android.cfg inside .bar file after sign. 

 

I try thsee 2 ways.

 

1. Using any .zip utility, add the android.cfg file to the .bar file from ProjectName\bin\classes, before sign the .bar package

2. Create the .cfg file and name it as your project name, drop it in the root directory of your project in eclipse then debug again

 

Please let me know how to resolve this issue.

 

Regards

Please use plain text.
New Contributor
ara_h13
Posts: 3
Registered: ‎03-13-2013
My Device: anything but.

Re: Creating Push-Enabled Android Apps

as a worst case you could do a lot using the command line editions of the tools eclipse automates. look for blackberry-signer in your eclipse installation folder under plugins somewhere, you can navigate to it with CMD and see what you can do, there are other utilities in there as well.

 

typically the flow i've found, outside eclipse, is: APK --> BAR --> sign the BAR --> deploy as separate, distinct steps, i believe eclipse hides a few of the stages. this may be an alternative if for whatever reason eclipse isn't working particularly well for you.

 

I've only just started doing this myself so i can't help you much more than that.

 

good luck.

Please use plain text.
Contributor
vmurarka
Posts: 18
Registered: ‎03-14-2013
My Device: Z10
My Carrier: NA

Re: Creating Push-Enabled Android Apps

I got push notification changes in and deployed to device:

 

1. I have used command line tools to create a bar using apk2bar

2. Uising a zip utility I unziped, added android.cfg and added "Archive-Asset-Name: android/android.cfg" into manifest file and then zipped back to .bar file

3. Then deployed to device which had the debug token installed as part of earlier steps.

Please use plain text.
Contributor
vmurarka
Posts: 18
Registered: ‎03-14-2013
My Device: Z10
My Carrier: NA

Re: Creating Push-Enabled Android Apps

Issue: getting "android/android.cfg: unknown asset" when adding android.cfg manually via a zip uitility into the bar file

 

Solution:

Option 1: Add below manual entry to the bar manifest file. (probably not best option to do)

Archive-Asset-Name: android/android.cfg"

 

Option 2: If you have an APK named {something}.APK (e.g., ‘foo.APK’), then running apk2bar with the ‘-m -ma’ arguments will automatically look for ‘foo.MF’ and ‘foo.CFG’ in the same folder.  If they exist, they will be packaged as part of the BAR.  HOWEVER, apk2bar also automatically renames the CFG file in the process - instead of ‘foo.CFG’, it appears in the BAR as ‘android\android.cfg’. When the resulting BAR is signed, the android.cfg file will get signed automatically.

 

Option 3: Put the <projectName>.cfg file under the root of the Android project and then create apk and then repackage it as bar and you will find ‘android\android.cfg’ file present in bar file.

 

For me since I started with an existing apk file (so just support existing apk on the BB device without any code modification), I prefered option #2.

 

also refer to: http://supportforums.blackberry.com/t5/Android-Runtime-Development/Not-receiving-push-notification-o...

Please use plain text.
Contributor
jolsys
Posts: 10
Registered: ‎08-13-2014
My Device: Blackberry 10
My Carrier: Play

Re: Creating Push-Enabled Android Apps

[ Edited ]

Hi,

 

I have big problem with generate android.cfg

 

The structure of my project looks like this:

MyProject

-assets

-src

-res

-AndroidManifest.xml

-MyProject.cfg

-other_files

Then I create MyProject.apk, next I create .bar file from my MyProject.apk , and there is no android.cfg file.

 

What I do wrong?

Maybe there are some restrictions?

I use proguard and what about min sdk??

 

Please use plain text.