当前位置: 首页>>代码示例>>Java>>正文


Java Sms.moveMessageToFolder方法代码示例

本文整理汇总了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);
}
 
开发者ID:CommonQ,项目名称:sms_DualCard,代码行数:8,代码来源:SmsReceiverService.java

示例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();
        }
    }
}
 
开发者ID:CommonQ,项目名称:sms_DualCard,代码行数:56,代码来源:SmsReceiverService.java

示例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();
        }
    }
}
 
开发者ID:slvn,项目名称:android-aosp-mms,代码行数:57,代码来源:SmsReceiverService.java


注:本文中的android.provider.Telephony.Sms.moveMessageToFolder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。