Skip to content

Instantly share code, notes, and snippets.

@enlacee
Created April 22, 2025 07:02
Show Gist options
  • Save enlacee/9bf3c8d24a9cb08be70a51790a69e309 to your computer and use it in GitHub Desktop.
Save enlacee/9bf3c8d24a9cb08be70a51790a69e309 to your computer and use it in GitHub Desktop.
Send SMS short and long (special characters)
// codigo kotlin made by anibal site: https://blog.anibalcopitan.com/2025/04/sms-largos-en-android-problema-y.html
/**
* Antes:
* Mensaje de yape:
* Yape! Victor A. Copitan N. te envió un pago por S/ 2.
*/
// Antes
val smsManager: SmsManager = SmsManager.getDefault()
smsManager.sendTextMessage(phoneNumber, null, message, null, null)
/**
* Ahora
* Mensaje de yape:
* Victor A. Copitan N. te envió un pago por S/ 222. El cód. de seguridad es: 541
*/
val smsManager: SmsManager = SmsManager.getDefault()
val parts: ArrayList<String> = smsManager.divideMessage(message)
smsManager.sendMultipartTextMessage(phoneNumber, null, parts, null, null)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment