了解用户何时在打电话
(Android) 前几天,我看到了一种注册广播接收器的方法,以了解屏幕何时变黑或反转。
现在我想找到一种方法来了解用户何时在打电话,但我没有找到这种情况的广播,那么我如何了解用户是否在打电话? (可能不需要总是运行会使电池放电的服务)。
TNK
瓦莱里奥
(Android) Some days ago I saw a way to register a broadcast receiver to understand when the screen goes black or the inverse.
Now i'd like to find a way to understand when the users is speaking at the phone but i don't find a broadcast for this case, so how can i understand if the user is at the phone? (Possibly without always running a service that would discharge the battery).
Tnk's
Valerio
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定是否在电话上“说话”,因为没有 API 可以检测到这一点,但您可以监听电话状态,例如:
不要忘记清单中的以下权限:
I'm not sure about "speaking" at the phone, since there is no API to detect that, but you can listen to the phone state, like:
Don't forget the following permission in the manifest: