Android Core SDK crash with Bluetooth (v5.18.1 and 5.19.x)

This is the log from our app.

It happens when

  • Using OS 12, connect a bluetooth headset before starting the app
  • Our app requests two permissions before using Vivox. Grant Mic permission but do not grant Nearby Devices permission (needed for searching and connecting bluetooth devices)
  • Start the Vivox engine, and then stop. Exit the app.
  • Open App Settings system dialog to grant the Nearby Devices permission
  • Start the app, start Vivox, and connect
  • problem: the exception is thrown (almost 100%) and also may cause ANR to our app (about 10% chance?)

Due to this problem I’ll not be able to upgrade the SDK in our app from 5.17.0 to 5.18 or 5.19.

Thanks.

I tested with Vivox Core SDK for Android 5.19.2 and still seeing the same crash happening.

`` --------- beginning of crash
2022-12-21 09:10:25.989 22437-22437 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.imvu.mobilecordova, PID: 22437
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.vivox.sdk.CallsAudioInterruptionListener.setBluetoothScoManager(com.vivox.sdk.BluetoothScoManager)' on a null object reference
at com.vivox.sdk.AudioChangeListener.updateBluetoothState(AudioChangeListener.java:95)
at com.vivox.sdk.AudioChangeListener.checkAudioRouteAndApplyChanges(AudioChangeListener.java:215)
at com.vivox.sdk.VxaAudioDeviceCallback.onAudioDevicesAdded(AudioChangeListener.java:49)
at android.media.AudioManager$NativeEventHandlerDelegate$1.handleMessage(AudioManager.java:7879)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8663)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

I tested with Vivox Core SDK for Android 5.19.4 and still seeing the same crash happening. So out app cannot upgrade from 5.17.0, which is also crashing in other place from time to time. Can you put some priority on this issue thanks.

E/AndroidRuntime: FATAL EXCEPTION: Thread-1654
Process: com.imvu.mobilecordova, PID: 4318
java.lang.NullPointerException: Attempt to invoke virtual method ‘void com.vivox.sdk.CallsAudioInterruptionListener.setBluetoothScoManager(com.vivox.sdk.BluetoothScoManager)’ on a null object reference
at com.vivox.sdk.AudioChangeListener.updateBluetoothState(AudioChangeListener.java:95)
at com.vivox.sdk.AudioChangeListener.checkAudioRouteAndApplyChanges(AudioChangeListener.java:215)
at com.vivox.sdk.AudioChangeListener$1CheckAudioRouteAndApplyChangesRunnable.run(AudioChangeListener.java:119)
at java.lang.Thread.run(Thread.java:1012)

Ok, now I found a workaround. By calling

AudioChangeListener.getInstance().registerAudioInterruptionListener()
AudioChangeListener.getInstance().registerAudioRouteChangeListeners()

the variable mCallsAudioInterruptionListener in com.vivox.sdk.AudioChangeListener is not null when start up next time.