Closed Bytecode-Velocity732 closed 6 months ago
try adding these to your AndroidManifest.xml
:
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.BLUETOOTH"
android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"
android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
does the runtime permission dialog pop up when you start your app?
@wilmxre permission dialog pops up and after allowing the permission it crashes. Permissions which you have mentioned was already added before. i will paste the permissions which i added on xml file here
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"
android:usesPermissionFlags="neverForLocation"/>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" tools:node="remove" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
it crashes because you call IncallManager.start
. by the crash report it looks like there is something wrong with the runtime permission, that you call in js side. make sure you are requesting the permission before you register your call related event listeners and call IncallManager.start
inside one of your event listeners. if you use CallKeep you should call it inside the didActivateAudioSession
event or when you get an incoming call. btw did you try it on another android device too? also what version of Android does your device?
@wilmxre as you can see here i am calling IncallManager.start
after getting the permission.
PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.BLUETOOTH_CONNECT, {
})
.then(async () => {
InCallManager.start({ media: 'audio', auto: true });
})
Also i verified it by checking the app info from the settings. Bluetooth Permission is allowed. I am not using CallKeep
atm. Android version is 13 (API level 33). It's also crashing on another devices too. but it's also android 13
interesting. i am using this library in our app which is used in various android devices and i didn't encounter this issue yet, but the react native version is only 72.4. so there might be something introduced in 73. i would suggest you to debug it in android studio with logcat, you can get more verbose log messages which could tell you more about where is the problem. maybe you have to patch the library and wrap some lines in version checking if statements
@wilmxre Yeah i guess it might to do with the RN version. cuz my friend is also using Incall manager and he is not facing the issue. Only difference is that he is on RN 72 and i am on the latest one. Incall manager versions and configurations are same for us. I will look through the logcat to see if i can find something there. Anyway thanks for the tips. i will comment down if i find the solution
FYI:- it doesn’t crash when i use other functions provided by incall manager. Issue is happening with only start function
@wilmxre Found the issue. targetSdkVersion
was missing from app/build.gradle
. while perfoming installDebug i was getting a warning on device saying that app is not compatible with new versions and i was installing the app by ignoring it. Guess permissions was not being granted properly due to that.
Platform :- Android
Versions:- "react-native-incall-manager": "^4.1.0" (issue is also in 4.2.0) "react-native": "^0.73.4",
javac 18.0.2.1 Gradle version :- 8.3 buildToolsVersion = "34.0.0" minSdkVersion = 24 compileSdkVersion = 34 targetSdkVersion = 34 ndkVersion = "25.2.9519653" kotlinVersion = "1.8.0"
Crash report:-
java.lang.SecurityException: Need BLUETOOTH permission at android.bluetooth.BluetoothHeadset.(BluetoothHeadset.java:431) at android.bluetooth.BluetoothAdapter.getProfileProxy(BluetoothAdapter.java:3821) at com.zxcpoiu.incallmanager.AppRTC.AppRTCBluetoothManager.getBluetoothProfileProxy(AppRTCBluetoothManager.java:471) at com.zxcpoiu.incallmanager.AppRTC.AppRTCBluetoothManager.start(AppRTCBluetoothManager.java:291) at com.zxcpoiu.incallmanager.InCallManagerModule.lambda$start$1(InCallManagerModule.java:577) at com.zxcpoiu.incallmanager.InCallManagerModule.$r8$lambda$Ari-AJTZzDZrRH5SokqnmsDPt0c(Unknown Source:0) at com.zxcpoiu.incallmanager.InCallManagerModule$$ExternalSyntheticLambda2.run(Unknown Source:2) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:211) at android.os.Looper.loop(Looper.java:300) at android.app.ActivityThread.main(ActivityThread.java:8395) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:559) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
crash report says it requires bluetooth permission. But it's already there on androidManifest.xml
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation"/>
also in app.tsx
PermissionsAndroid.request( PermissionsAndroid.PERMISSIONS.BLUETOOTH_CONNECT, { }) .then(async () => { InCallManager.start({ media: 'audio', auto: true }); }) FYI:- recently upgraded RN version and all the packages. it was working on old version. Happens everytime
If anyone needs more info about the issue feel free to ask. Any help or insights are appreciated. Have a nice day :)