在 Intent.ACTION_NEW_OUTGOING_CALL 的 BroadcastReceiver 内发出 HttpClient 请求
我正在尝试为我的 Android 手机编写一个类似于 Google Voice 的服务:它将拦截拨出的电话,用我从网络请求中查找的号码替换最初拨打的号码。
我知道可以使用请求 Intent.ACTION_NEW_OUTGOING_CALL
广播的 BroadcastReceiver 转接拨出电话,如 Android 源代码所示:
我的问题是,如何礼貌地执行长时间运行的任务,例如查找 setResultData(...) ;
使用网络请求?
Google Voice 以某种方式执行此请求。如何?他们是否取消原来的拨出呼叫并使用自定义的 InCallScreen 活动?我不这么认为,因为使用 Google Voice 时的通话 UI 与手机的 UI 相匹配(我在 Cliq、MT3G 和 Droid 上尝试过)。
I'm trying to write a service for my Android phone that is similar to Google Voice: it will intercept outgoing calls, replacing the originally dialed number with a number that I look up from a web request.
I know that outgoing calls can be diverted using a BroadcastReceiver that requests the Intent.ACTION_NEW_OUTGOING_CALL
broadcast as demonstrated in the android source code here:
My question is, how do I politely perform a long-running task like looking up the number for setResultData(...);
using a web request?
Google Voice performs this request, somehow. How? Do they cancel the original outgoing call and use a custom InCallScreen Activity? I don't think so, because the in-call UI when using Google Voice matches the phone's UI (I have tried it on Cliq, MT3G, and Droid).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过取消原始拨出呼叫、发出 Web 请求(同时显示我自己的“请稍候”对话框活动),然后创建另一个拨出呼叫来解决该问题。
不过,我对其他解决方案持开放态度。
I worked around the problem by indeed canceling the original outgoing call, making the web request (while showing my own "please wait" dialog activity), and then creating another outgoing call.
I'm open to other solutions though.