blindfold wrote:
> Hi,
> 
> I want to avoid the SDK 1.0 and 1.1 workaround for playing synthesized
> audio as of SDK1.5, but for older phones or firmware (SDK 1.0 and 1.1
> based) I want to maintain backward compatibility and first write audio
> to flash memory in order to play the resulting audio file from there.


Use the android.os.Build class to check the runtime version:
  Build.VERSION.SDK will be 3 for 1.5 and 2 for 1.1



Best Regards,

Xavier Le Vourch


> That is in pseudocode,
> 
> if (phone_supports_SDK1.5) {
>    // Use new AudioTrack API to play in-memory audio
> else {  // SDK 1.0 and 1.1 phones
>    // Write to flash and play file with MediaPlayer
> }
> 
> How can I do this? In Java ME I would check for missing classes, but
> what is the best way to do this in Android? Clearly I want to skip the
> old crude workaround on newer phones without breaking functionality on
> older phones - and not release more than one APK file. (So the
> "minSdkVersion" must remain at 1 or 2.) Obviously the older phones
> must not "see" the code in the SDK1.5 branch. Must one do a try-catch
> on class.forName("android.media.AudioTrack"), or does Android offer
> some other mechanism to create backward compatible applications?

--
XLV Labs

Publisher of "Who Called?", Caller Id application for Android phones:

http://www.xlv-labs.com/whocalled

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to