From cbccddfb741a22143af49623022ff0566320715b Mon Sep 17 00:00:00 2001 From: KGCybeX Date: Mon, 18 Sep 2023 03:37:24 +0200 Subject: [PATCH 1/2] fix: `openPhoneAccountSettings` using try/catch with fallback --- .../types/TelecomManagerExtension.kt | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/android/src/main/kotlin/com/twilio/twilio_voice/types/TelecomManagerExtension.kt b/android/src/main/kotlin/com/twilio/twilio_voice/types/TelecomManagerExtension.kt index 08481346..76f251c5 100644 --- a/android/src/main/kotlin/com/twilio/twilio_voice/types/TelecomManagerExtension.kt +++ b/android/src/main/kotlin/com/twilio/twilio_voice/types/TelecomManagerExtension.kt @@ -61,13 +61,22 @@ object TelecomManagerExtension { fun TelecomManager.openPhoneAccountSettings(activity: Activity) { if (Build.MANUFACTURER.equals("Samsung", ignoreCase = true)) { - val intent = Intent(TelecomManager.ACTION_CHANGE_PHONE_ACCOUNTS) - intent.component = ComponentName( - "com.android.server.telecom", - "com.android.server.telecom.settings.EnableAccountPreferenceActivity" - ) - intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK - activity.startActivity(intent, null) + try { + val intent = Intent(TelecomManager.ACTION_CHANGE_PHONE_ACCOUNTS) + intent.component = ComponentName( + "com.android.server.telecom", + "com.android.server.telecom.settings.EnableAccountPreferenceActivity" + ) + intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK + activity.startActivity(intent, null) + } catch (e: Exception) { + Log.e("TelecomManager", "openPhoneAccountSettings: ${e.message}") + + // use fallback method + val intent = Intent(TelecomManager.ACTION_CHANGE_PHONE_ACCOUNTS) + activity.startActivity(intent, null) + } + } else { val intent = Intent(TelecomManager.ACTION_CHANGE_PHONE_ACCOUNTS) activity.startActivity(intent, null) From bdd239f927f5c62110f9ae01fbd19549d4aea6b8 Mon Sep 17 00:00:00 2001 From: KGCybeX Date: Mon, 18 Sep 2023 03:38:35 +0200 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f81ea977..abc8a86b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Next release * Fix: [Web] Multiple missed call notifications +* Fix: [Android] `openPhoneAccountsSettings` not always opening on various Android (mainly Samsung) devices ## 0.1.0