Code example for SmsMessage: Receiving Text Messages (SMS)

Methods: getMessageBody, getOriginatingAddress

0
    private final String mMessage;
    private final String mNumber;
 
    private SmsMessageInfo(final SmsMessage message) throws NullPointerException
    { 
        this(message.getMessageBody(), message.getOriginatingAddress());
    } // SmsMessageInfo 
 
    public SmsMessageInfo(final JSONObject jsonReply) throws JSONException
    { 
       this(jsonReply.getString(JSON_MESSAGE), jsonReply.getString(JSON_NUMBER));
    } // SmsMessageInfo 
 
    public SmsMessageInfo(final String message, final String number)
    { 
        super(); 
        if (message == null || number == null)
        { 
            throw new IllegalArgumentException("message and number must not be null");
        } // if 
        mMessage = message;