Android Airplane Mode - Different API versions -
can tell me how handle situation. aware api 17, testing airplane mode has been moved setting.system
settings.global
. knowing many of users on phones using older api, wanting handle deprecation correctly, i've written following method:
@suppresswarnings("deprecation") public static boolean isairplanemodeon(context context) { try { return settings.global.getint(context.getcontentresolver(), settings.global.airplane_mode_on, 0) != 0; } catch (exception e) { return settings.system.getint(context.getcontentresolver(), settings.system.airplane_mode_on, 0) != 0; } }
the problem in manifest, i've set minsdk value 9, want it. conflict error:
call requires api level 17 (current min 9)
what correct way handle type of situation? thanks!
check version user has
if(build.version.sdk_int <= build.version_codes.jellybean){ }else{ }
then suppress lint error
Comments
Post a Comment