Search code examples
androidandroid-broadcastreceivertelephonymanager

Obtaining Telephone Number from a Call at a Specific Moment in Time


New to Android development and I’d like to very quickly check if the user is in a call AND get the phone number of the person the user is in a call with. In reviewing https://developer.android.com/reference/android/telephony/package-summary, it appears quickly grabbing this phone number is not possible. It appears the only time the number is available is with a PhoneStateListener and onCallStateChanged during an actual “state change” or using a BroadcastReceiver with state changes and grabbing EXTRA_INCOMING_NUMBER or related when a change occurs. Am I missing anything?

Thank you.


Solution

  • you're not missing anything, that's the way to do it.