开发者

Making an HttpClient request inside a BroadcastReceiver for Intent.ACTION_NEW_OUTGOING_CALL

开发者 https://www.devze.com 2022-12-19 19:06 出处:网络
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 re

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 dive开发者_StackOverflow中文版rted using a BroadcastReceiver that requests the Intent.ACTION_NEW_OUTGOING_CALL broadcast as demonstrated in the android source code here:

https://android.googlesource.com/platform/packages/apps/Phone/+/gingerbread-release/src/com/android/phone/ProcessOutgoingCallTest.java

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).


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消