Permission Denial With Broadcast Receiver

I got it to work by following this link closely Intercepting outgoing call - what am I missing? (thanks ajit)

I ended up taking off the PHONE_STATE permission, adding android:enabled="true" and android:exported="true" to my receiver in the manifest, relocating the NEW_OUTGOING_CALL permission to below application(not sure if this is necessary), taking away the intended sdk versions and basically copying the receiver from the link.

Updated manifest code from receiver tag to manifest tag is:

    <receiver
            android:name=".testreceive3"
            android:enabled="true"
            android:exported="true" >
            <intent-filter>

                <action android:name="android.intent.action.NEW_OUTGOING_CALL"/>-->
            </intent-filter>
        </receiver>
    </application>

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

 </manifest>

U need to apply the runtime permission int your code when your code running on Android 6.0 or above.


I have launched the same application on Android emulator and nothing helped, even

android:enabled="true"
android:exported="true"

The solution was to go to Settings->Apps -> MyApplication -> Permissions -> Toggle Phone Permission on.

Android Phone Permission for Application