hiennguyen92 / flutter_callkit_incoming

Flutter Callkit Incoming
https://pub.dev/packages/flutter_callkit_incoming
MIT License
178 stars 305 forks source link

Caused by java.lang.SecurityException com.nextgen_digitech.myhealth_patients was not granted this permission: android.permission.WRITE_SETTINGS. #341

Open Irfan995 opened 1 year ago

Irfan995 commented 1 year ago

I have implemented Flutter Callkit Incoming to my project using Flutter WebRTC. But I am getting java.lang.SecurityException com this error on a few Android devices especially versions below 12. I have already added android.permission.WRITE_SETTINGS to manifest file. How can I solve this issue? This is preventing to receive calls when the app is closed or running in the background.

VocsyJay commented 1 year ago

hello I am facing same error in my case I am using agora

TGS-DivyeshPatel commented 8 months ago

Hello, I am facing the same error in old Android versions below 11.

netgfx commented 1 month ago

I have the same issue on Android 11, for push notifications I'm using Firebase messaging. The whole error stack is:

E/AndroidRuntime(20629): FATAL EXCEPTION: main
E/AndroidRuntime(20629): Process: com.myapp.test, PID: 20629
E/AndroidRuntime(20629): java.lang.RuntimeException: Unable to start service com.hiennv.flutter_callkit_incoming.CallkitSoundPlayerService@a0978c0 with Intent { cmp=com.myapp.test/com.hiennv.flutter_callkit_incoming.CallkitSoundPlayerService (has extras) }: java.lang.SecurityException: com.myapp.test was not granted  this permission: android.permission.WRITE_SETTINGS.
E/AndroidRuntime(20629):    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4813)
E/AndroidRuntime(20629):    at android.app.ActivityThread.access$2000(ActivityThread.java:301)
E/AndroidRuntime(20629):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2215)
E/AndroidRuntime(20629):    at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(20629):    at android.os.Looper.loop(Looper.java:246)
E/AndroidRuntime(20629):    at android.app.ActivityThread.main(ActivityThread.java:8653)
E/AndroidRuntime(20629):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(20629):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
E/AndroidRuntime(20629):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
E/AndroidRuntime(20629): Caused by: java.lang.SecurityException: com.myapp.test was not granted  this permission: android.permission.WRITE_SETTINGS.
E/AndroidRuntime(20629):    at android.os.Parcel.createExceptionOrNull(Parcel.java:2386)
E/AndroidRuntime(20629):    at android.os.Parcel.createException(Parcel.java:2370)
E/AndroidRuntime(20629):    at android.os.Parcel.readException(Parcel.java:2353)
E/AndroidRuntime(20629):    at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:190)
E/AndroidRuntime(20629):    at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
E/AndroidRuntime(20629):    at android.content.ContentProviderProxy.call(ContentProviderNative.java:732)
E/AndroidRuntime(20629):    at android.provider.Settings$NameValueCache.putStringForUser(Settings.java:2830)
E/AndroidRuntime(20629):    at android.provider.Settings$System.putStringForUser(Settings.java:3458)
E/AndroidRuntime(20629):    at android.provider.Settings$System.putStringForUser(Settings.java:3442)
E/AndroidRuntime(20629):    at android.media.RingtoneManager.setActualDefaultRingtoneUri(RingtoneManager.java:916)
E/AndroidRuntime(20629):    at android.media.RingtoneManager.setRingtonesAsInitValue(RingtoneManager.java:1445)
E/AndroidRuntime(20629):    at android.media.RingtoneManager.getActualDefaultRingtoneUri(RingtoneManager.java:866)
E/AndroidRuntime(20629):    at com.hiennv.flutter_callkit_incoming.CallkitSoundPlayerService.playSound(CallkitSoundPlayerService.kt:75)
E/AndroidRuntime(20629):    at com.hiennv.flutter_callkit_incoming.CallkitSoundPlayerService.onStartCommand(CallkitSoundPlayerService.kt:28)
E/AndroidRuntime(20629):    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4795)
E/AndroidRuntime(20629):    ... 8 more
I/.myapp.test(20629): Background young concurrent copying GC freed 52476(2995KB) AllocSpace objects, 41(2372KB) LOS objects, 48% free, 5768KB/10MB, paused 62.490ms total 157.615ms