Thanks to jotobjects and EboMike for their responses.

I will try to describe my situation better: I have an application that
send SMS messages by using SmsManager class. In the SDK 1.5 version of
the application (I mean I set 1.5 as the Project Build Target)
everything works fine because I use the SmsManager class located at:
android.telephony.gsm.SmsManager which does only support GSM.

When i try to create the SDK 1.6 version of it (Setting the Project
Build Target as 1.6) it does not compile because the SmsManager class
was moved to android.telephony.SmsManager (which is ok because it now
supports CDMA). But then my code should be changed if I want to
compile using the new SDK.

=======================================
My desired solution is: Use conditional compilation to mark my code to
use one of the SmsManager classes depending on the SDK I choose as my
project build target. Encapsulating this logic into my own SmsEngine
class so everything in my code works smoothly and supporting 1.5-1.6
firmware devices and also supporting CDMA in the devices that use
1.6.  Without the need to change my code further than a simple
conditional compilation.

Problem: As EboMike says there is not such thing as conditional
compilation in Java (because Java gurus claim there is not need to
such a thing). I personally believe that in the fantasy world were
nobody fails designing their APIS the though "Nobody needs conditional
compilation" is valid. But nobody is perfect and all the APIs out
there in every platforms contains design errors or changes in future
designs that leads to the need to improve!.
=======================================

=======================================
My current solution is: Keep my project build target as 1.5.
Supporting 1.5 and 1.6 devices without any changes in my source code.

Problem: My application does not support CDMA Sms messaging. I can't
benefit from new improvements of performance or bug fixes for the new
1.6 implementation of the SDK.
=======================================

=======================================
Possible alternatives: Keep two releases of the application, one for
1.5 and another one for 1.6 supporting CDMA.  Use reflection into a
wrapper class to identify which of the firmware I am running allowing
me to decide the implementation to use.

Problem: Neither alternative convince me. Two releases can confuse my
users. Reflection is too expensive in performance and also does not
makes my code clear (It scrambles the source code a little).
=======================================

Until there is aren't 1.5 firmware device out there I suppose I
couldn't resolve my problem.

Thanks for your help everyone!.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to