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 c开发者_开发问答all ("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.
精彩评论