Hi Greivin,

if you look into the 1.6 Android framework source, you see that
telephony.gsm.SmsManager is only a proxy for telephony.SmsManager.
So if you start a SDK 1.5 app on 1.6 it automatically (indirectly)
uses the telephony.SmsManager with all it's features.

Here's the snippet of the gsm.SmsManager's constructor:
    @Deprecated
    private SmsManager() {
        mSmsMgrProxy = android.telephony.SmsManager.getDefault();
    }

All the other methods are then referring to the mSmsMgrProxy to
redirect the calls. They don't have any own logic left.

If someday all phones are upgraded to 1.6 or 2.0 and you decide to
compile for these versions only, you should obviously switch to the
new SmsManager.

Hope that solves your issue,
Chris

On Oct 9, 3:09 pm, Greivin Lopez <greivin.lo...@gmail.com> wrote:
> I have a question related to backward compatibility in Android. My
> applications uses SmsManager class that was deprecated in SDK 1.5 and
> moved to other package in SDK 1.6 to support CDMA. That's OK.
>
> The problem is I want to support 1.5 SDK and also being able to use
> the new SmsManager class. I think the only way to do that is using the
> solution suggested by EboMike (with reflection), but I think is more a
> patch than the correct way around.  Other solution could be to compile
> the code to the desire target and keep two different releases of the
> application but I don't like the idea to maintain two versions of my
> code.
>
> I think a must elegant design for this is to use some sort of compiler
> directives that let us developers to differentiate parts of our code
> associated to one version of the SDK or another one, but I don't see
> anything in Android to accomplish that.
>
> Is there a way to achieve this? I suppose there isn't but maybe
> someone could share some new ideas on this scenario. I would
> appreciate any help. Thanks.

-- 
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