Dany Wehbe
Dany Wehbe

Reputation: 115

send blank SMS with SmsManager.sendTextMessage method in android

I created an android app and one of its functions is to send SMS, when I try to send blank SMS it throws an exception.

Here is the code:

SmsManager sm=SmsManager.getDefault();
sm.sendTextMessage("9999", null, messageBody,sentPI, deliveredPI);

messageBody maybe empty string and maybe it is a string, previous method throws IllegalArgumentException when messageBody is empty string!

what can I do to send blank SMS?

Upvotes: 0

Views: 1418

Answers (1)

jtt
jtt

Reputation: 13541

After looking at the Documentation:

This method:

Throws

IllegalArgumentException    if destinationAddress or text are empty

Upvotes: 1

Related Questions