Home » Android » android – What's meant by result errors of SmsManager?

android – What's meant by result errors of SmsManager?

Posted by: admin June 15, 2020 Leave a comment


When I send an SMS using SmsManager, the result intent broadcasted holds a value of 5


What’s meant by every one of them? and please mention a test case that could generate each one.
I know that RESULT_OK denotes a successfully sent SMS. GENERIC_FAILURE occurs for general erros (e.g. I’ve no credit).

But I’ve activated Airplane mode and tried to send an SMS. I’ve thought it would trigger NO_SERVICE error, but a RADIO_OFF was triggered instead. Also the official documentation is not demonstrating them very well.

How to&Answers:

Here’s my comments on the documentation of SmsManager:

  • RESULT_ERROR_GENERIC_FAILURE: Generic failure cause

    Something went wrong and there’s no way to tell what, why or how.

  • RESULT_ERROR_NO_SERVICE: Failed because service is currently unavailable

    Your device simply has no cell reception. You’re probably in the middle of nowhere, somewhere inside, underground, or up in space. Certainly away from any cell phone tower.

  • RESULT_ERROR_NULL_PDU: Failed because no pdu provided

    Something went wrong in the SMS stack, while doing something with a protocol description unit (PDU) (most likely putting it together for transmission).

  • RESULT_ERROR_RADIO_OFF: Failed because radio was explicitly turned off

    You switched your device into airplane mode, which tells your device exactly “turn all radios off” (cell, wifi, Bluetooth, NFC, …).

In the end, most apps need not care why sending an SMS failed (except ask the user if airplane mode is on in case of RESULT_ERROR_RADIO_OFF), because there’s nothing the app itself can do to remedy it.



Most often this error arises when the message too long for 1 SMS. In such situation use this:

ArrayList<String> texts = smsManager.divideMessage(text);
smsManager.sendMultipartTextMessage(phone, null, texts, null, null)


It should be possible to know more about the reason behind RESULT_ERROR_GENERIC_FAILURE. In the receiver which catches the outcome of the SMS send:

public void onReceive(Context context, Intent intent) {

    // Other code processing other outcomes

    if (getResult() == SmsManager.RESULT_ERROR_GENERIC_FAILURE) {
        int errorCode = intent.getIntExtra("errorCode", -1);
        if (errorCode != -1) {
            // process errorCode ...

    // More code ...

I have yet to prove it, but the lists provide here and here provide what may be an explanation of errorCode. The acronymns here provide some explanation of how to understand those lists. For example:

Number issues

  • 1 The number you are sending to is simply not used by anyone.
  • 28 The number you are sending to exists, but no phone is associated with it. It’s not allocated to a SIM card at the moment.
  • 195 The number you are sending to is not valid.
  • 196 The number you are sending to is barred to (or by, unclear) you.

Other issues

  • 42 The network is too busy
  • 38 The network is out of order (probably for a while)

It seems to me that there is quite some overlap between the codes, but I’m not an expert in these things.