I'm trying to redirect outgoing calls to a different phone number on an Android device. So, I use a BroadcastReceiver "listening" for the NEW_OUTGOING_CALL intent, on his onReceive() method I use the setResultData() method to change the phone number.
Like this:
public void onReceive(Context arg0, Intent arg1) {
setResultData("351978923221");
}
In the emulator all goes well, but on my real device (a crappy ZTE X850 with Android 2.1 I believe) it doesn't if the calling Intent originates in an Activity wich is part of the same application. After the dialing screen appears, the phone terminates the call.
Any thoughts out there on why this happens?
Note: I know my question is basically the same as this one but I chose to ask it again anyway to provide additional details about what goes wrong.
Manifest File
An excerpt...
<receiver android:name=".OutgoingCallDetection" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.NEW_OUTGOING_CALL"
android:priority="9999" />
</intent-filter>
</receiver>
</application>
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
I cut the dialed call and redialed the new call. It worked perfectly on the device.
This is the code part:
Hope this helps.