Post 9: Xamarin: Getting the API version that the phone device is currently running and support Multiple API Levels
As described in the android documentation, the SDK level (integer) the phone is running is available in:
Android.OS.Build.VERSION.SdkInt;
The enum corresponding to this int is in the android.os.Build.VERSION_CODES class.
Code example
Android.OS.Build.VERSION.SdkInt;
The enum corresponding to this int is in the android.os.Build.VERSION_CODES class.
Code example
// device android version
int currentapiVersion = (int)Android.OS.Build.VERSION.SdkInt;
// support Multiple API Levels
if (currentapiVersion >= (int)Android.OS.Build.VERSION_CODES.Froyo){
// Do something for froyo and above versions
} else{
// do something for phones running an SDK before froyo
}
Comments
Post a Comment