Telephony
Telephony copied to clipboard
Sms failure handling
This fix will handle all sms sending failures (RESULT_ERROR_GENERIC_FAILURE,RESULT_ERROR_NO_SERVICE,RESULT_ERROR_NULL_PDU,RESULT_ERROR_RADIO_OFF
) to SMS_FAIL.
For example :
final SmsSendStatusListener listener = (SendStatus status) {
// Handle the status
switch (status) {
case SendStatus.SENT:
print("SMS is sent!");
break;
case SendStatus.DELIVERED:
print("SMS delivered.");
break;
case SendStatus.FAIL:
print("Error sending sms");
break;
default:
}
};
telephony.sendSms(
to: "1234567890",
message: "May the force be with you!",
statusListener: listener
);