catch and show exceptions thrown at sending a message

This commit is contained in:
tibbi 2022-11-13 20:31:03 +01:00
parent 7f6343c354
commit a65916c54e
1 changed files with 5 additions and 1 deletions

View File

@ -72,7 +72,11 @@ fun Context.sendMessage(text: String, addresses: List<String>, subscriptionId: I
transaction.setExplicitBroadcastForSentSms(smsSentIntent)
transaction.setExplicitBroadcastForDeliveredSms(deliveredIntent)
Handler(Looper.getMainLooper()).post {
transaction.sendNewMessage(message)
try {
transaction.sendNewMessage(message)
} catch (e: Exception) {
showErrorToast(e)
}
}
}