react-native-incall-manager
react-native-incall-manager copied to clipboard
speaker on/off not working on android 11
setSpeakerphoneOn and setForceSpeakerphoneOn not working on android 11 when set speaker, the earphone sounds a little bit less, and the speaker no sound. android 10 is working well.
My android 10 not work
updated the setSpeakerphoneOn function on incallmanagermodule
@ReactMethod
public void setSpeakerphoneOn(final boolean enable) {
try {
Class audioSystemClass = Class.forName("android.media.AudioSystem");
Method setForceUse = audioSystemClass.getMethod("setForceUse", int.class, int.class);
setForceUse.invoke(null, 1, 1);
}catch (Exception err){
err.printStackTrace();
}
if (enable != audioManager.isSpeakerphoneOn()) {
Log.d(TAG, "setSpeakerphoneOn(): " + enable);
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
audioManager.setSpeakerphoneOn(enable);
}
}
You should add the MODIFY_AUDIO_SETTINGS to the manifest.
I have the same problem. Not working on Android 11-12.
Already have MODIFY_AUDIO_SETTINGS , also tried both methods setSpeakerphoneOn and setForceSpeakerphoneOn.
Any solution so far ?
@dragoshuniq i also have same problem...
@dragoshuniq try to add this (InCallManagerModule.java)

fixed in #201