... ...

The implementation of the corresponding broadcast receiver would look something like this: public class MyOutgoingCallHandler extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // Extract phone number reformatted by previous receivers String phoneNumber = getResultData(); if (phoneNumber == null) { // No reformatted number, use the original phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); } // My app will bring up the call, so cancel the broadcast setResultData(null); // Start my app to bring up the call ... } } Because the NEW_OUTGOING_CALL broadcast is ordered, your app can choose whether to consume the call request itself or simply process the number and pass the result data on to other apps that may be interested. In this example, the broadcast receiver brings up a phone call on it’s own service and sets the result data to null. This prevents the call request from reaching the default phone app. An anti-pattern Rather than listening for NEW_OUTGOING_CALL Intents, some apps have mistakenly set up intent filters for CALL_PRIVILEGED Intents as a way to handle outgoing calls. This is not a recommended approach, because the system may send a CALL_PRIVILEGED Intent for any number, including emergency numbers. Since non-system apps can’t reformat emergency numbers or place emergency calls, attempting to handle CALL_PRIVILEGED could inadvertently interfere with access to emergency numbers. CALL_PRIVILEGED should only be used by apps that have the necessary signatureOrSystem-level permission — it is not designed for use by any third-party apps. Check your apps for proper use of NEW_OUTGOING_CALL If your app provides phone calling services and already uses intent filters to handle outgoing call requests, take a few minutes to make sure it is listening for the proper Intent: NEW_OUTGOING_CALL. If your app includes intent filters that listen for CALL_PRIVILEGED Intents, make sure to remove those filters and related code from the app (in favor of NEW_OUTGOING_CALL) and publish the updated app as soon as possible.">

Rss Feed Tweeter button Facebook button Technorati button Reddit button Myspace button Linkedin button Delicious button Digg button Stumbleupon button Newsvine button