本文整理汇总了Java中android.provider.Telephony.Sms.STATUS_PENDING属性的典型用法代码示例。如果您正苦于以下问题:Java Sms.STATUS_PENDING属性的具体用法?Java Sms.STATUS_PENDING怎么用?Java Sms.STATUS_PENDING使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.provider.Telephony.Sms
的用法示例。
在下文中一共展示了Sms.STATUS_PENDING属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onHandleIntent
@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: getSmsStatusText
private String getSmsStatusText(int status) {
if (status == Sms.STATUS_NONE) {
// No delivery report requested
return mContext.getString(R.string.status_none);
} else if (status >= Sms.STATUS_FAILED) {
// Failure
return mContext.getString(R.string.status_failed);
} else if (status >= Sms.STATUS_PENDING) {
// Pending
return mContext.getString(R.string.status_pending);
} else {
// Success
return mContext.getString(R.string.status_received);
}
}
示例3: getSmsStatusText
private String getSmsStatusText(int status) {
if (status == Sms.STATUS_NONE) {
// No delivery report requested
return getString(R.string.status_none);
} else if (status >= Sms.STATUS_FAILED) {
// Failure
return getString(R.string.status_failed);
} else if (status >= Sms.STATUS_PENDING) {
// Pending
return getString(R.string.status_pending);
} else {
// Success
return getString(R.string.status_received);
}
}
示例4: sendFirstQueuedMessage
public synchronized void sendFirstQueuedMessage() {
boolean success = true;
// get all the queued messages from the database
final Uri uri = Uri.parse("content://sms/queued");
ContentResolver resolver = getContentResolver();
Cursor c = SqliteWrapper.query(this, resolver, uri,
SEND_PROJECTION, null, null, "date ASC"); // date ASC so we send out in
// same order the user tried
// to send messages.
if (c != null) {
try {
if (c.moveToFirst()) {
String msgText = c.getString(SEND_COLUMN_BODY);
String address = c.getString(SEND_COLUMN_ADDRESS);
int threadId = c.getInt(SEND_COLUMN_THREAD_ID);
int status = c.getInt(SEND_COLUMN_STATUS);
int msgId = c.getInt(SEND_COLUMN_ID);
Uri msgUri = ContentUris.withAppendedId(Sms.CONTENT_URI, msgId);
SmsMessageSender sender;
sender = new SmsSingleRecipientSender(this,
address, msgText, threadId, status == Sms.STATUS_PENDING,
msgUri, MSimSmsManager.getDefault().getPreferredSmsSubscription());
if (LogTag.DEBUG_SEND ||
LogTag.VERBOSE ||
Log.isLoggable(LogTag.TRANSACTION, Log.VERBOSE)) {
Log.v(TAG, "sendFirstQueuedMessage " + msgUri +
", address: " + address +
", threadId: " + threadId);
}
try {
sender.sendMessage(SendingProgressTokenManager.NO_TOKEN);;
mSending = true;
} catch (MmsException e) {
Log.e(TAG, "sendFirstQueuedMessage: failed to send message " + msgUri
+ ", caught ", e);
mSending = false;
messageFailedToSend(msgUri, SmsManager.RESULT_ERROR_GENERIC_FAILURE);
success = false;
}
}
} finally {
c.close();
}
}
if (success) {
// We successfully sent all the messages in the queue. We don't need to
// be notified of any service changes any longer.
unRegisterForServiceStateChanges();
}
}
示例5: sendFirstQueuedMessage
public synchronized void sendFirstQueuedMessage() {
boolean success = true;
// get all the queued messages from the database
final Uri uri = Uri.parse("content://sms/queued");
ContentResolver resolver = getContentResolver();
Cursor c = SqliteWrapper.query(this, resolver, uri,
SEND_PROJECTION, null, null, "date ASC"); // date ASC so we send out in
// same order the user tried
// to send messages.
if (c != null) {
try {
if (c.moveToFirst()) {
String msgText = c.getString(SEND_COLUMN_BODY);
String address = c.getString(SEND_COLUMN_ADDRESS);
int threadId = c.getInt(SEND_COLUMN_THREAD_ID);
int status = c.getInt(SEND_COLUMN_STATUS);
int msgId = c.getInt(SEND_COLUMN_ID);
Uri msgUri = ContentUris.withAppendedId(Sms.CONTENT_URI, msgId);
SmsMessageSender sender = new SmsSingleRecipientSender(this,
address, msgText, threadId, status == Sms.STATUS_PENDING,
msgUri);
if (LogTag.DEBUG_SEND ||
LogTag.VERBOSE ||
Log.isLoggable(LogTag.TRANSACTION, Log.VERBOSE)) {
Log.v(TAG, "sendFirstQueuedMessage " + msgUri +
", address: " + address +
", threadId: " + threadId);
}
try {
sender.sendMessage(SendingProgressTokenManager.NO_TOKEN);;
mSending = true;
} catch (MmsException e) {
Log.e(TAG, "sendFirstQueuedMessage: failed to send message " + msgUri
+ ", caught ", e);
mSending = false;
messageFailedToSend(msgUri, SmsManager.RESULT_ERROR_GENERIC_FAILURE);
success = false;
// Sending current message fails. Try to send more pending messages
// if there is any.
sendBroadcast(new Intent(SmsReceiverService.ACTION_SEND_MESSAGE,
null,
this,
SmsReceiver.class));
}
}
} finally {
c.close();
}
}
if (success) {
// We successfully sent all the messages in the queue. We don't need to
// be notified of any service changes any longer.
unRegisterForServiceStateChanges();
}
}