Question

I have an Android app that I want to make available to BlackBerry 10 users by porting for the BB Android Runtime. The only stumbling block is my Android app uses Google Maps API (com.google.android.maps) which the runtime doesn't support. The map screen is only a small feature of the app and I'm happy to disable it for BlackBerry users, but is this possible? I don't want to maintain two copies of the application, can I somehow code the one app so that the conversion to BAR works but the maps are still available on Android?

Was it helpful?

Solution 2

Turns out what I want to do is not possible - any references to Google Maps API has to be removed completely from the app. See response from the BlackBerry forums :

"No, it's not going to work. Save yourself time trying to find a fix, and just copy your project to a new one and make the needed changes for blackberry. If you are using source control, then you can try branching off for that probject.

By the way. If you want Google maps in your app, it can be done using a webview and Google's javascript API."

OTHER TIPS

The map screen is only a small feature of the app and I'm happy to disable it for BlackBerry users, but is this possible?

You can add android:required="false" to your <uses-library> element, and detect at runtime whether you have the MapActivity class before trying to link to your map. Here is a sample app demonstrating this.

In theory, BB's packager should allow this. Whether it does or not, I cannot say.

You have to remove all references to MapView or MapActivity in the Android code for you to be able to port over to BlackBerry. I'd recommend going one step further: replace MapView with WebView and load the Google Maps mobile site with Javascript. More info can be found here:

http://developer.blackberry.com/android/apisupport/apisupport_mapping_support.html

Yes, that will result in maintaining two versions of your app, but it will provide a better experience for BlackBerry users.

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top