views:

204

answers:

1

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:

http://android.git.kernel.org/?p=platform/packages/apps/Phone.git;a=blob;f=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).

A: 

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.

supbro