Android 2.3发短信详细流程(3)
public void sendText(String destAddr, String scAddr,
String text, PendingIntent sentIntent, PendingIntent deliveryIntent) {
mPhone.getContext().enforceCallingPermission(
"android.permission.SEND_SMS",
"Sending SMS message");
if (Log.isLoggable("SMS", Log.VERBOSE)) {
log("sendText: destAddr=" + destAddr + " scAddr=" + scAddr +
" text='"+ text + "' sentIntent=" +
sentIntent + " deliveryIntent=" + deliveryIntent);
}
mDispatcher.sendText(destAddr, scAddr, text, sentIntent, deliveryIntent);
}
IccSmsInterfaceManager对象的sendText()方法调用了SMSDispatcher类的sendText()方法,继续往下:
5. 第四阶段:SMSDispatcher.java(frameworks/base/telephony/java/com/android/internal/telephony/SMSDispatcher.java)
该类是一个抽象类,它的sendText()并没有实现,它的实现类是GsmSMSDispatcher.java或者CdmaSMSDispatcher.java,假设我们用的GSM网络,则此时调用到GsmSMSDispatcher的sendText()方法。
6. 第五阶段:GsmSMSDispatcher.java(frameworks/base/telephony/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java)
核心代码如下:
view plaincopy to clipboardprint?protected void sendText(String destAddr, String scAddr, String text,
PendingIntent sentIntent, PendingIntent deliveryIntent) {
SmsMessage.SubmitPdu pdu = SmsMessage.getSubmitPdu(
scAddr, destAddr, text, (deliveryIntent != null));
sendRawPdu(pdu.encodedScAddress, pdu.encodedMessage, sentIntent, deliveryIntent);
}
......
protected void sendText(String destAddr, String scAddr, String text,
PendingIntent sentIntent, PendingIntent deliveryIntent) {
SmsMessage.SubmitPdu pdu = SmsMessage.getSubmitPdu(
scAddr, destAddr, text, (deliveryIntent != null));
相关新闻>>
- 发表评论
-
- 最新评论 更多>>