本文整理汇总了Java中android.telephony.SmsMessage.getStatus方法的典型用法代码示例。如果您正苦于以下问题:Java SmsMessage.getStatus方法的具体用法?Java SmsMessage.getStatus怎么用?Java SmsMessage.getStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.telephony.SmsMessage
的用法示例。
在下文中一共展示了SmsMessage.getStatus方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onHandleIntent
import android.telephony.SmsMessage; //导入方法依赖的package包/类
@Override
protected void onHandleIntent(Intent intent) {
// This method is called on a worker thread.
Uri messageUri = intent.getData();
byte[] pdu = intent.getByteArrayExtra("pdu");
String format = intent.getStringExtra("format");
SmsMessage message = updateMessageStatus(this, messageUri, pdu, format);
// Called on a background thread, so it's OK to block.
if (message != null && message.getStatus() < Sms.STATUS_PENDING) {
MessagingNotification.blockingUpdateNewMessageIndicator(this,
MessagingNotification.THREAD_NONE, message.isStatusReportMessage());
}
}
示例2: updateMessageStatus
import android.telephony.SmsMessage; //导入方法依赖的package包/类
private SmsMessage updateMessageStatus(Context context, Uri messageUri, byte[] pdu,
String format) {
SmsMessage message = SmsMessage.createFromPdu(pdu);
if (message == null) {
return null;
}
// Create a "status/#" URL and use it to update the
// message's status in the database.
Cursor cursor = SqliteWrapper.query(context, context.getContentResolver(),
messageUri, ID_PROJECTION, null, null, null);
try {
if (cursor.moveToFirst()) {
int messageId = cursor.getInt(0);
Uri updateUri = ContentUris.withAppendedId(STATUS_URI, messageId);
int status = message.getStatus();
boolean isStatusReport = message.isStatusReportMessage();
ContentValues contentValues = new ContentValues(2);
log("updateMessageStatus: msgUrl=" + messageUri + ", status=" + status +
", isStatusReport=" + isStatusReport);
contentValues.put("status", status);
contentValues.put("date_sent", System.currentTimeMillis());
SqliteWrapper.update(context, context.getContentResolver(),
updateUri, contentValues, null, null);
} else {
error("Can't find message for status update: " + messageUri);
}
} finally {
cursor.close();
}
return message;
}
示例3: updateMessageStatus
import android.telephony.SmsMessage; //导入方法依赖的package包/类
private SmsMessage updateMessageStatus(Context context, Uri messageUri, byte[] pdu,
String format) {
SmsMessage message = SmsMessage.createFromPdu(pdu, format);
if (message == null) {
return null;
}
// Create a "status/#" URL and use it to update the
// message's status in the database.
Cursor cursor = SqliteWrapper.query(context, context.getContentResolver(),
messageUri, ID_PROJECTION, null, null, null);
try {
if (cursor.moveToFirst()) {
int messageId = cursor.getInt(0);
Uri updateUri = ContentUris.withAppendedId(STATUS_URI, messageId);
int status = message.getStatus();
boolean isStatusReport = message.isStatusReportMessage();
ContentValues contentValues = new ContentValues(2);
if (Log.isLoggable(LogTag.TAG, Log.DEBUG)) {
log("updateMessageStatus: msgUrl=" + messageUri + ", status=" + status +
", isStatusReport=" + isStatusReport);
}
contentValues.put(Sms.STATUS, status);
contentValues.put(Inbox.DATE_SENT, System.currentTimeMillis());
SqliteWrapper.update(context, context.getContentResolver(),
updateUri, contentValues, null, null);
} else {
error("Can't find message for status update: " + messageUri);
}
} finally {
cursor.close();
}
return message;
}