This may be very basic question but I really cannot find any proper solution for this.
I was developing app (which have service) on Android 2.2. Then I realize that I should also make it compatible to Android 1.5.
But for android 1.5, onStartCommand() method was not there and instead onStart() method was there. And for Android 2.0+, onStart() method is deprecated.
So my question is, As Java don't have support for pre-processor directives, do I need to make two build (one for android 1.5+ and o开发者_高级运维ther for android 2.0+)?
Or is there any easy solution for this problem?
Thanks in advance.
Actually I would not bother writing for 1.5 as >80% are on 2.1+ these days.
Usually the solution is to test for features that are not present in earlier versions and to work around them.
Just compiling for 1.5 and 2.2 will not help as you say, so you either have to implement the missing functionality yourself or reduce the functionality of your app.
精彩评论