Closed D-I-S-C closed 2 years ago
@D-I-S-C
Can you share the version of the dependencies used in your app build.gradle? https://github.com/twilio/voice-quickstart-android/blob/master/app/build.gradle#L74
@kbagchiGWC I have shared the versions for the project and the app in the original post under versions.
Below is the actual build.gradle (app) code used in my app:
apply plugin: 'com.android.application'
ext.playCustomRingback = { def playCustomRingback = System.getenv("playCustomRingback");
if (playCustomRingback == null) {
logger.log(LogLevel.INFO, "Could not locate playCustomRingback environment variable. " +
"Trying local.properties")
Properties properties = new Properties()
if (project.rootProject.file('local.properties').exists()) {
properties.load(project.rootProject.file('local.properties').newDataInputStream())
playCustomRingback = properties.getProperty('playCustomRingback')
}
}
if (playCustomRingback == null) {
playCustomRingback = false
}
return playCustomRingback;
}
android { compileSdkVersion versions.compileSdk
compileOptions {
sourceCompatibility versions.java
targetCompatibility versions.java
}
defaultConfig {
applicationId "com.twilio.voice.quickstart"
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
buildConfigField("boolean", "playCustomRingback", "${playCustomRingback()}")
}
debug {
buildConfigField("boolean", "playCustomRingback", "${playCustomRingback()}")
}
}
// Specify that we want to split up the APK based on ABI
splits {
abi {
// Enable ABI split
enable true
// Clear list of ABIs
reset()
// Specify each architecture currently supported by the Video SDK
include "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
// Specify that we do not want an additional universal SDK
universalApk false
}
}
}
dependencies { implementation "com.twilio:audioswitch:${versions.audioSwitch}" implementation "com.twilio:voice-android:${versions.voiceAndroid}" implementation "com.google.android.material:material:${versions.material}" implementation "com.google.firebase:firebase-messaging:${versions.firebase}" implementation "androidx.lifecycle:lifecycle-extensions:${versions.androidxLifecycle}" androidTestImplementation "androidx.test.ext:junit:${versions.junit}"
// added for firebase
implementation platform('com.google.firebase:firebase-bom:30.1.0') // Firebase BoM
implementation 'com.google.firebase:firebase-analytics'
}
apply plugin: 'com.google.gms.google-services'
@D-I-S-C
Try replacing you current code in registerForCallInvites()
with the code below. Let me know if this fixes your issue. We will look in to updating the QS with this changes.
/*
* Register your FCM token with Twilio to receive incoming call invites
*/
private void registerForCallInvites() {
FirebaseMessaging.getInstance ().getToken ()
.addOnCompleteListener ( task -> {
if (!task.isSuccessful ()) {
return;
}
if (null != task.getResult ()) {
String fcmToken = Objects.requireNonNull ( task.getResult () );
Log.i(TAG, "Registering with FCM");
Voice.register(accessToken, Voice.RegistrationChannel.FCM, fcmToken, registrationListener);
}
} );
}
The code is now compiling without errors - thank you! However, when I run it on any kind of emulator using the AVD and make a call as instructed, I hear "we are sorry an application error has occurred", the call is finished and I get the following message on my console (in error logs): "An attempt to retrieve content from https://my-quickstart-dev.twil.io/make-call returned the HTTP status code 404"
Description
When building the app, the following error happens:
This error is due to FirebaseInstanceId now being deprecated, however not too sure on the new code required to make it work.
Steps to Reproduce
Code
Expected Behavior
Succesful build.
Actual Behavior
Error as decribed above.
Reproduces How Often
100% (all the time).
Versions
Device Model
Nexus 4 API 27