Re: [android-developers] How to leverage a specific API when available?
On Fri, Mar 16, 2012 at 2:40 PM, RedBullet <scottedchapman@gmail.com> wrote:
> So, I had been developing an app to run on API 10, and when I switched to
> run it on API 7 noticed that AudioManager.startBluetoothSCO didn't exist...
>
> So, how do I handle that? I can just remove it form my code, but not sure if
> that means I just can't send audio to SCO in old versions of android.
>
> Is there a reasonable approach to leveraging a specific API function if I am
> running on an API that supports it?
There are lots of reasonable approaches. For example, if you set your
build target to API Level 10, and you are not deploying to Android
1.x, you can just wrap your version-specific code in version guard
blocks:
if (android.os.Build.VERSION.SDK_INT>=android.os.Build.VERSION_CODES.FROYO) {
// do something with startBluetoothSCO()
}
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy
Warescription: Three Android Books, Plus Updates, One Low Price!
--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home