smsManager.sendMultipartTextMessage(
mDests[i], mServiceCenter, messages,
sentIntents, deliveryIntents);
In my SmsReceiver (sentIntents) sometimes I receive getResultCode() = 0
.
According to the documentation: http://developer.android.com/reference/android/telephony/SmsManager.html
It means STATUS_ON_ICC_FREE
. But I can't understand what it is.
When it is returned - SMS are not sent.
What does this mean and how to fix it? What is the reason for STATUS_ON_ICC_FREE
?
You're just comparing result code to the wrong constant. SmsManager.sendMultipartTextMessage
Javadoc clearly states about the possible values returned by the getResultCode()
in the sentIntents
broadcast:
The result code will be Activity.RESULT_OK for success, or one of these errors:
RESULT_ERROR_GENERIC_FAILURE
RESULT_ERROR_RADIO_OFF
RESULT_ERROR_NULL_PDU
In my opinion STATUS_ON_ICC_xxx
constants were added to the public API by mistake since they are used only by hidden methods of the SmsManager class: copyMessageToIcc
, deleteMessageFromIcc
etc.
UPDATE
However this doesn't explain why do you receive 0
from getResultCode()
. As neither of these constant is equal to zero (Activity.RESULT_CANCEL = 0
but there is no mention of it in the SmsManager
javadoc). Quick search through Android Sources also doesn't give any clue were 0
could come from.
One possibility could be that some other application catch the sentIntent
broadcast and call setResultCode
explicitly. However I was sure up to now that it's impossible in Android to prevent the SMS from being sent at the application level.