Change the number for the outgoing call, add the prefix

According to this blogpost on the Android developers blog, it must be doable to change the outgoing call number: http://android-developers.blogspot.com/2011/01/processing-ordered-broadcasts.html

The problem is that it does not work for me, my code is:

String action = intent.getAction();
if (Intent.ACTION_NEW_OUTGOING_CALL.equals(action)) {
    // Try to read the phone number from previous receivers.
    String phonenumber = getResultData();

    if (phonenumber == null) {
        // We could not find any previous data. Use the original
        // phone
        // number in this case.
        phonenumber = intent
                .getStringExtra(Intent.EXTRA_PHONE_NUMBER);
    }

        String reformatedNumber = reformatNumber(phonenumber);
    setResultData(reformatedNumber);                                
}

Despite the fact that I reformat the number dialed by the phone number called.

Any insight?

I have these permissions in my manifest:

<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.CALL_PRIVILEGED" />

, , , , , , "" , . , - , .

+3
2

blogpost :

0 NEW_OUTGOING_CALL ( ), , , , , ACTION_NEW_OUTGOING_CALL ( , ). 0, 2 , , , :

" - 0, . , . ; ".

, , , 0? , 0.

+2

, : , .

android:priority <intent-filter> , , .

+1

Source: https://habr.com/ru/post/1793267/


All Articles