Example usage for android.telephony SmsMessage getStatus

List of usage examples for android.telephony SmsMessage getStatus

Introduction

In this page you can find the example usage for android.telephony SmsMessage getStatus.

Prototype

public int getStatus() 

Source Link

Document

GSM: For an SMS-STATUS-REPORT message, this returns the status field from the status report.

Usage

From source file:com.rjfun.cordova.sms.SMSPlugin.java

private JSONObject getJsonFromSmsMessage(SmsMessage sms) {
    JSONObject json = new JSONObject();

    try {/*from  w ww .  j  a v a2  s . co m*/
        json.put(ADDRESS, sms.getOriginatingAddress());
        json.put(BODY, sms.getMessageBody()); // May need sms.getMessageBody.toString()
        json.put(DATE_SENT, sms.getTimestampMillis());
        json.put(DATE, System.currentTimeMillis());
        json.put(READ, MESSAGE_IS_NOT_READ);
        json.put(SEEN, MESSAGE_IS_NOT_SEEN);
        json.put(STATUS, sms.getStatus());
        json.put(TYPE, MESSAGE_TYPE_INBOX);
        json.put(SERVICE_CENTER, sms.getServiceCenterAddress());

    } catch (Exception e) {
        e.printStackTrace();
    }

    return json;
}

From source file:com.dileepindia.cordova.sms.SMSPlugin.java

private JSONObject getJsonFromSmsMessage(SmsMessage sms) {
    JSONObject json = new JSONObject();
    try {//from   w w  w .j a  v a 2  s  . c om
        json.put("address", sms.getOriginatingAddress());
        json.put("body", sms.getMessageBody());
        json.put("date_sent", sms.getTimestampMillis());
        json.put("date", System.currentTimeMillis());
        json.put("read", 0);
        json.put("seen", 0);
        json.put("status", sms.getStatus());
        json.put("type", 1);
        json.put("service_center", sms.getServiceCenterAddress());
    } catch (Exception e) {
        e.printStackTrace();
    }

    return json;
}