Question

Blackberry 10 now accept android but not google map.

Basically we want to port our application to android and use different technique for google map but we don't want to fork the project. So we want all update on other area on the original project to carry over to the bb project kind of thing (it should still be the same project)

So I want to put some preprocessed that says : (If for blackberry, do this). Kind of thing.

Is there a way to do so?

Basically worst come to worse, we just get rid map feature for bb version.

Was it helpful?

Solution

To start with I would like to say that it is possible have a jar file that supports both android and blackberry. For example if you have webservices that you are hitting form your android and blackberry app, you can isolate the http request + xml parsers to a separate jar file. Its possible and I have successfully done it.

There are subtle differences between android and blackberry (the java part). Blackberry is sometimes 1 version behind android, so you need to add some annotations to support your code on blackberry. You do need to separate out the java classes from your android to a separate project. I also faintly recall that you need to remove unused imports.

All in all its possible, go ahead. You will save a whole lot of time, and work for your developers.

DONT do the "if blackberry" do this. You will get in a mess on the code. And if ever u want to "not" support blackberry, oh man u will have a task in your hand. You also may not want to tie down your android release just because you cant get the damn thing working on blackberry. Separate projects with common stuff in a lib jar outside. Thats the way to go dude.

OTHER TIPS

You can create a boolean value in a constants class:

public class Constants{

public static boolean isForBlackberry = true;

}

and then you can operate with this. So if you want to do something with a map you can check it like this:

if(!Constants.isForBlackberry){
// open up a map
}
else{
// don't open up a map, do something else instead
}

Now every time you export an apk(Android) you set your boolean value to false, but if you export a bar(Blackberry) file you set it to true.

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