如何拨打未接来电?
我正在开发一个我想要的 Android 应用程序 能够拨打电话,但有非常精确的限制,这是 “拨打未接来电”。我想要的是,能够挂断电话 电话铃声响起的那一刻。
现在我能够知道手机何时开始尝试并拨打电话 呼叫,但几秒钟内没有“响铃”活动 网络,这是我愿意做的。
我怎样才能停止这一刻呢?
I am working on an Android app on which I want to be
able to make calls but with a very precise restriction, this is
"making missed calls". What I want is, to be able to hang up just the
moment the phone starts ringing.
right now I am able to know when the phone starts to try and make the
call, but for a few seconds there is no "ringing" activity over the
network, which is what I am willing to do.
How can I stop this exact moment?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通过 PhoneStateListener 使用
onCallStateChanged()
只能检测手机何时开始拨出电话以及何时挂断拨出电话,但无法确定何时开始“响铃”。我尝试过一次,查看下面的代码:拨出时从
IDLE
开始到OFFHOOK
,挂机时到IDLE。唯一的解决方法是使用计时器在拨出电话开始并经过几秒钟后挂断电话,但是,您永远无法保证电话会开始响铃。
Using the
onCallStateChanged()
via the PhoneStateListener you can only detect when the phone starts to make an outgoing call and when the outgoing call is hunged up but you can't determine when a "ringing" is started. I tried once, check out the code below:An outgoing call starts from
IDLE
toOFFHOOK
when dialed out, to IDLE when hunged up.The only workaround is to use a timer to hang up after the outgoing call starts and some few seconds passes, but then, you're never guaranteed the phone will start ringing.
在 PhoneStateListener 中使用 onCallStateChanged()
Use onCallStateChanged() in PhoneStateListener