简体   繁体   中英

Android: Detect currently active phone number during phone call

Goal: On the Android platform, detect the phone number of the individual with whom the user is speaking to now.

Currently, using PhoneListener, there exists a certain ambiguity in the case of calls on hold.

Case: User is talking to someone during a call ("Call 1"). The user is therefore in call state OFFHOOK. Then the user is in state RINGING indicating an incoming phone call ("Call 2"). The state then changes to OFFHOOK. This could indicate one of two possibilities -- either the user answered Call 2, and placed Call 1 on hold. Alternatively, the user rejected Call 2 and returned to Call 1.

How is it possible to distinguish between the two cases? Is it possible to detect the phone number of the CURRENT CALL on the phone?

Use a PhoneStateLister and onCallStateChanged . There you can also see the incoming number.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM