本文整理汇总了Java中android.provider.Telephony.Sms.moveMessageToFolder方法的典型用法代码示例。如果您正苦于以下问题:Java Sms.moveMessageToFolder方法的具体用法?Java Sms.moveMessageToFolder怎么用?Java Sms.moveMessageToFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.provider.Telephony.Sms
的用法示例。
在下文中一共展示了Sms.moveMessageToFolder方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: messageFailedToSend
import android.provider.Telephony.Sms; //导入方法依赖的package包/类
private void messageFailedToSend(Uri uri, int error) {
if (Log.isLoggable(LogTag.TRANSACTION, Log.VERBOSE) || LogTag.DEBUG_SEND) {
Log.v(TAG, "messageFailedToSend msg failed uri: " + uri + " error: " + error);
}
Sms.moveMessageToFolder(this, uri, Sms.MESSAGE_TYPE_FAILED, error);
MessagingNotification.notifySendFailed(getApplicationContext(), true);
}
示例2: handleSmsSent
import android.provider.Telephony.Sms; //导入方法依赖的package包/类
private void handleSmsSent(Intent intent, int error) {
Uri uri = intent.getData();
mSending = false;
boolean sendNextMsg = intent.getBooleanExtra(EXTRA_MESSAGE_SENT_SEND_NEXT, false);
if (LogTag.DEBUG_SEND) {
Log.v(TAG, "handleSmsSent uri: " + uri + " sendNextMsg: " + sendNextMsg +
" mResultCode: " + mResultCode +
" = " + translateResultCode(mResultCode) + " error: " + error);
}
if (mResultCode == Activity.RESULT_OK) {
if (LogTag.DEBUG_SEND || Log.isLoggable(LogTag.TRANSACTION, Log.VERBOSE)) {
Log.v(TAG, "handleSmsSent move message to sent folder uri: " + uri);
}
if (!Sms.moveMessageToFolder(this, uri, Sms.MESSAGE_TYPE_SENT, error)) {
Log.e(TAG, "handleSmsSent: failed to move message " + uri + " to sent folder");
}
if (sendNextMsg) {
sendFirstQueuedMessage();
}
// Update the notification for failed messages since they may be deleted.
MessagingNotification.nonBlockingUpdateSendFailedNotification(this);
} else if ((mResultCode == SmsManager.RESULT_ERROR_RADIO_OFF) ||
(mResultCode == SmsManager.RESULT_ERROR_NO_SERVICE)) {
if (Log.isLoggable(LogTag.TRANSACTION, Log.VERBOSE)) {
Log.v(TAG, "handleSmsSent: no service, queuing message w/ uri: " + uri);
}
// We got an error with no service or no radio. Register for state changes so
// when the status of the connection/radio changes, we can try to send the
// queued up messages.
registerForServiceStateChanges();
// We couldn't send the message, put in the queue to retry later.
Sms.moveMessageToFolder(this, uri, Sms.MESSAGE_TYPE_QUEUED, error);
mToastHandler.post(new Runnable() {
public void run() {
Toast.makeText(SmsReceiverService.this, getString(R.string.message_queued),
Toast.LENGTH_SHORT).show();
}
});
} else if (mResultCode == SmsManager.RESULT_ERROR_FDN_CHECK_FAILURE) {
mToastHandler.post(new Runnable() {
public void run() {
Toast.makeText(SmsReceiverService.this, getString(R.string.fdn_check_failure),
Toast.LENGTH_SHORT).show();
}
});
} else {
messageFailedToSend(uri, error);
if (sendNextMsg) {
sendFirstQueuedMessage();
}
}
}
示例3: handleSmsSent
import android.provider.Telephony.Sms; //导入方法依赖的package包/类
private void handleSmsSent(Intent intent, int error) {
Uri uri = intent.getData();
mSending = false;
boolean sendNextMsg = intent.getBooleanExtra(EXTRA_MESSAGE_SENT_SEND_NEXT, false);
if (LogTag.DEBUG_SEND) {
Log.v(TAG, "handleSmsSent uri: " + uri + " sendNextMsg: " + sendNextMsg +
" mResultCode: " + mResultCode +
" = " + translateResultCode(mResultCode) + " error: " + error);
}
if (mResultCode == Activity.RESULT_OK) {
if (LogTag.DEBUG_SEND || Log.isLoggable(LogTag.TRANSACTION, Log.VERBOSE)) {
Log.v(TAG, "handleSmsSent move message to sent folder uri: " + uri);
}
if (!Sms.moveMessageToFolder(this, uri, Sms.MESSAGE_TYPE_SENT, error)) {
Log.e(TAG, "handleSmsSent: failed to move message " + uri + " to sent folder");
}
if (sendNextMsg) {
sendFirstQueuedMessage();
}
// Update the notification for failed messages since they may be deleted.
MessagingNotification.nonBlockingUpdateSendFailedNotification(this);
} else if ((mResultCode == SmsManager.RESULT_ERROR_RADIO_OFF) ||
(mResultCode == SmsManager.RESULT_ERROR_NO_SERVICE)) {
if (Log.isLoggable(LogTag.TRANSACTION, Log.VERBOSE)) {
Log.v(TAG, "handleSmsSent: no service, queuing message w/ uri: " + uri);
}
// We got an error with no service or no radio. Register for state changes so
// when the status of the connection/radio changes, we can try to send the
// queued up messages.
registerForServiceStateChanges();
// We couldn't send the message, put in the queue to retry later.
Sms.moveMessageToFolder(this, uri, Sms.MESSAGE_TYPE_QUEUED, error);
mToastHandler.post(new Runnable() {
public void run() {
Toast.makeText(SmsReceiverService.this, getString(R.string.message_queued),
Toast.LENGTH_SHORT).show();
}
});
} else if (mResultCode == SmsManager.RESULT_ERROR_FDN_CHECK_FAILURE) {
messageFailedToSend(uri, mResultCode);
mToastHandler.post(new Runnable() {
public void run() {
Toast.makeText(SmsReceiverService.this, getString(R.string.fdn_check_failure),
Toast.LENGTH_SHORT).show();
}
});
} else {
messageFailedToSend(uri, error);
if (sendNextMsg) {
sendFirstQueuedMessage();
}
}
}