I am trying to implement a native module which provides connection service in react native. But I am facing an error. As I am not an android/java developer, I am not being able to find the cause of the following error.
E:\projects\deets-mobile-cp\node_modules\react-native-connection-service\android\src\main\java\com\genm\CallConnection.java:10: error: cannot find symbol
@TargetApi(Build.VERSION_CODES.O_MR1)
^
symbol: variable O_MR1
location: class VERSION_CODES
E:\projects\deets-mobile-cp\node_modules\react-native-connection-service\android\src\main\java\com\genm\CallConnection.java:14: error: cannot find symbol
setConnectionProperties(PROPERTY_SELF_MANAGED);
^
symbol: variable PROPERTY_SELF_MANAGED
location: class CallConnection
CallConnection.java
package com.genm;
import android.annotation.TargetApi;
import android.os.Build;
import android.telecom.Connection;
import android.util.Log;
import static android.content.ContentValues.TAG;
@TargetApi(Build.VERSION_CODES.O_MR1)
public class CallConnection extends Connection{
public CallConnection(){
setConnectionProperties(PROPERTY_SELF_MANAGED);
setAudioModeIsVoip(true);
}
@Override
public void onAnswer(){
Log.d(TAG, "On answer to the call");
}
}
Be sure that you have compileSdkVersion = 27 in your build.gradle file
compileSdkVersionis the SDK level which will be used to compile your app. If you need to access properties or methods added on API 27 you need to update this value accordingly. This means that if you needed to access (for example)Build.VERSION_CODES.Pyou should have setcompileSdkVersion = 28and so on...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With