URI encode phone number before sending SMS to it

This commit is contained in:
tibbi 2020-08-08 17:53:10 +02:00
parent 1a55ec4665
commit 3d12a8da46
1 changed files with 1 additions and 1 deletions

View File

@ -229,7 +229,7 @@ fun Context.sendSMSToContacts(contacts: ArrayList<Contact>) {
val number = it.phoneNumbers.firstOrNull { it.type == ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE } val number = it.phoneNumbers.firstOrNull { it.type == ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE }
?: it.phoneNumbers.firstOrNull() ?: it.phoneNumbers.firstOrNull()
if (number != null) { if (number != null) {
numbers.append("${number.value};") numbers.append("${Uri.encode(number.value)};")
} }
val uriString = "smsto:${numbers.toString().trimEnd(';')}" val uriString = "smsto:${numbers.toString().trimEnd(';')}"