04-24-2011 04:01 AM
I have read that code is upward compatible meaning that an app written with the 4.5 api should run on later models of the phone. On the other hand I have also seen code like this;
//#ifdef ABOVE_4_6
phoneNumber = callInfo.getPhoneNumber();
//#else
phoneNumber = callInfo.getDisplayPhoneNumber();
//#endif
Indicating that different code is needed for different API:s. Could someone elaborate this a bit? Currently
I have the same source for 4.5, 4.6, 4.7, 5 and 6 but at various places I have precompiler statements like the one above.
For world wide distribution it is a bit cumbersome to have to 5 different executables. Or is it possible to code so that the correct API to use is decided at runtime instead of at compile time
Solved! Go to Solution.
04-25-2011 11:43 AM
It's not possible to pick the proper API at runtime (at least not now). If you try to install a COD with APIs from 6.0 on a device running 4.5, it would either not install or crash on starting up. The "upwards compatability" that is talked about is to mean that if you made an app for 4.2.1, it will work on 6.1. Preprocessor is the best way to go since, at least for Eclipse, when you switch API versions, it automatically switches the preprocessor for that API version.
04-25-2011 01:02 PM
Thanks rcmaniac25
I was not fully aware of the upwards compatability so I had precompiler statements at appropiate places to use the most recent api call when coding from 4.5 to 6 I realize now that that is not really needed since the 4.5 code works fine on all of these OS:es (tested). So the problem sort of "went away" at least for the current relesae of the app. There are 2 new releases under way and hopefully it will stay that way.