Android: Detect currently active phone number during phone call

守給你的承諾、 提交于 2019-12-09 13:35:07

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/4592086/android-detect-currently-active-phone-number-during-phone-call

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!