A new feature that I’m putting into the LTE Discovery Android app is the ability to not automatically go into airplane mode when the user is taking a call. This post will explain a few things that you need to know when setting this up.

TelephonyManager.CALL_STATE_IDLE is an int with a constant value of 0 (0×00000000).
TelephonyManager.EXTRA_STATE_IDLE is a String with a constant value of “IDLE”
TelephonyManager.EXTRA_STATE_RINGING is a String with a constant value of “RINGING”
TelephonyManager.EXTRA_STATE_OFFHOOK is a String with a constant value of “OFFHOOK”

What do these values mean?
Idle means that the user is currently not engaged with the phone in any way (for calling). The ringing state occurs when there is an outside call to the user’s phone. And when the phone is offhook, it means the user is currently taking a call or the user’s phone is actively dialing the numbers (i.e. after the user typed in the number, they pressed the call button). Onhook would technically mean the user is not “touching” the phone, but that state doesn’t exist on Android.

The official Android docs don’t explain this exactly, but it is a great resource: http://developer.android.com/reference/android/telephony/TelephonyManager.html

 - Danial Goodwin -