Permission Denial With Broadcast Receiver

前端 未结 6 849
醉酒成梦
醉酒成梦 2021-02-13 13:27

I am trying to create an app which enters a log message when I make an outgoing call.

However, when I run the code, I get a permission denial, despite the fact that I h

相关标签:
6条回答
  • 2021-02-13 13:51

    Best solution is when you run the code activate usb debugging, make sure you select disable permissions monitor settings in developer settings ! App wont be asked for permissions by the OS anymore. Happy helping :)

    This will work without changing anything in manifest!

    0 讨论(0)
  • 2021-02-13 13:53

    Use permission CALL_PHONE instead of OUTGOING

    <uses-permission android:name="android.permission.CALL_PHONE" />
    
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    
    0 讨论(0)
  • 2021-02-13 14:03

    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>
    
    0 讨论(0)
  • 2021-02-13 14:06

    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

    0 讨论(0)
  • 2021-02-13 14:08

    You should add the following thing in your Manifest receiver

     <service android:name=".CallReceiver"
                android:enabled="true"
                android:exported="false" >
            </service>
    
    0 讨论(0)
  • 2021-02-13 14:08

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

    0 讨论(0)
提交回复
热议问题