java - How can one detect airplane mode on Android? -


i have code in application detects if wi-fi actively connected. code triggers runtimeexception if airplane mode enabled. display separate error message when in mode anyway. how can reliably detect if android device in airplane mode?

/** * gets state of airplane mode. *  * @param context * @return true if enabled. */ private static boolean isairplanemodeon(context context) {     return settings.system.getint(context.getcontentresolver(),            settings.system.airplane_mode_on, 0) != 0;  } 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -