diff --git a/app/build.gradle b/app/build.gradle index cd05d47..3124ff4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -70,7 +70,7 @@ dependencies { testImplementation 'junit:junit:4.12' implementation 'com.twilio:audioswitch:0.1.3' - implementation 'com.twilio:voice-android:5.2.0' + implementation 'com.twilio:voice-android:5.3.0' implementation 'com.android.support:design:28.0.0' implementation 'com.android.support:support-media-compat:28.0.0' implementation 'com.android.support:animated-vector-drawable:28.0.0' diff --git a/app/src/main/java/com/twilio/voice/quickstart/VoiceActivity.java b/app/src/main/java/com/twilio/voice/quickstart/VoiceActivity.java index a6be0f9..a02ba73 100644 --- a/app/src/main/java/com/twilio/voice/quickstart/VoiceActivity.java +++ b/app/src/main/java/com/twilio/voice/quickstart/VoiceActivity.java @@ -51,6 +51,7 @@ import java.util.ArrayList; import java.util.HashMap; +import java.util.Set; import java.util.List; import java.util.Locale; @@ -277,6 +278,28 @@ public void onDisconnected(@NonNull Call call, CallException error) { } resetUI(); } + /* + * currentWarnings: existing quality warnings that have not been cleared yet + * previousWarnings: last set of warnings prior to receiving this callback + * + * Example: + * - currentWarnings: { A, B } + * - previousWarnings: { B, C } + * + * Newly raised warnings = currentWarnings - intersection = { A } + * Newly cleared warnings = previousWarnings - intersection = { C } + */ + public void onCallQualityWarningsChanged(@NonNull Call call, + @NonNull Set currentWarnings, + @NonNull Set previousWarnings) { + currentWarnings.retainAll(previousWarnings); + previousWarnings.removeAll(currentWarnings); + String message = String.format( + Locale.US, + "Newly raised warnings: " + currentWarnings + " Clear warnings " + previousWarnings); + Log.e(TAG, message); + Snackbar.make(coordinatorLayout, message, Snackbar.LENGTH_LONG).show(); + } }; } diff --git a/exampleCustomAudioDevice/build.gradle b/exampleCustomAudioDevice/build.gradle index c854e4d..5cd933a 100644 --- a/exampleCustomAudioDevice/build.gradle +++ b/exampleCustomAudioDevice/build.gradle @@ -45,7 +45,7 @@ android { dependencies { testImplementation 'junit:junit:4.12' - implementation 'com.twilio:voice-android:5.2.0' + implementation 'com.twilio:voice-android:5.3.0' implementation 'com.android.support:design:28.0.0' implementation 'com.android.support:support-media-compat:28.0.0' implementation 'com.android.support:animated-vector-drawable:28.0.0'