Is there any way to get the API version that the phone is currently running?
try this:
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD) { // only for gingerbread and newer versions }