Add permissions & service to android/app/src/main/AndroidManifest.xml
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application>
...
<service
android:name="com.carusto.ReactNativePjSip.PjSipService"
android:enabled="true"
android:exported="true" />
...
</application>
react-native link
In android/app/src/main/java/com/xxx/MainActivity.java
import android.view.Window;
import android.view.WindowManager;
import android.os.Bundle;
...
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Window w = getWindow();
w.setFlags(
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED,
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
);
}
If your Android targetSdk is 23 or above you should grant android.permission.RECORD_AUDIO
at runtime before making/receiving an audio call.
To check and request Android permissions, please check out react-native-android-permissions.