I'm encountering an issue with Android's SmsManager where it reports that the message has been sent successfully, but the intended recipient does not receive the SMS.
While shorter messages get sent successfully using the same function, the longer emergency message, which remains within the SMS character limit, fails to reach the recipient. The SmsManager indicates successful sending in the logs, but the recipient never receives the message.
I've verified that the number1 and number2 variables contain valid phone numbers, and there don't seem to be any issues with permissions as the app has the necessary SEND_SMS permission granted.
What could be causing this discrepancy, where shorter messages are sent successfully, but the longer emergency message within the character limit fails to reach the recipient? Any insights or suggestions on how to troubleshoot or circumvent this issue would be greatly appreciated.
Here's a snippet of the code I'm using to send the SMS:
private void sendEmergencySMS() {
String message = "SOS! Emergency at my location! https://maps.google.com/maps?q=" +
currentLocation.latitude + "," + currentLocation.longitude;
SmsManager smsManager = SmsManager.getDefault();
ArrayList<String> parts = smsManager.divideMessage(message);
String[] emergencyNumbers = {number1, number2};
for (String number : emergencyNumbers) {
if (number != null) {
smsManager.sendMultipartTextMessage(number, null, parts, null, null);
Log.e("wew", "Sending to: " + number + " in parts: " + parts.size());
} else {
Log.e("wew", "Number is null, skipping...");
}
}
}