Intent with action android.intent.action.CALL_PRIVILEGED is called when you making a call from phonebook using following way:
Phone Book->Contact->Long Click on the phonenumber -> Choose make call from dropdown menu.
Following code should be place in Manifest:
<activity>
<intent-filter>
<action android:name="android.intent.action.CALL_PRIVILEGED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
For HTC some changes there:
<activity>
<intent-filter>
<action android:name="android.intent.action.CALL_PRIVILEGED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/phone" />
<data android:mimeType="vnd.android.cursor.item/phone_v2" />
<data android:mimeType="vnd.android.cursor.item/person" />
</intent-filter>
</activity>
When this code is added to Manifest and you try to make call as described above you can get Application Chooser and this way to intercept the call and continue making call by the choosen application.
As for android.intent.action.NEW_OUTGOING_CALL it used in BroadcastReceivers, when you want to get notification about outgoing call. For example if you want to to that you should put following cod to Manifest:
<receiver android:name=".CallReceiver">
<intent-filter>
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
</intent-filter>
</receiver>
and create:
public class CallReceiver extends BroadcastReceiver{
private static final String TAG = "Call_Receiver";
@Override
public void onReceive(Context context, Intent intent) {
Bundle bundle = intent.getExtras();
//Notification there
....
}
}
Using this will you get notification all times when outgoing call happend.
The main difference beеween this items that first intercept intent and second only get a result that something happend.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…