欢迎来到天天文库
浏览记录
ID:44648299
大小:72.00 KB
页数:5页
时间:2019-10-24
《短信发送状态报告流程分析》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、//应用层分析:L//SmsSingleRecipientSender.java2.publicbooleansendMcssage(longtoken)throwsMmsException{3.if(mMessageText==null){4.//Don'ttrytosendanemptymessage,anddestinationshouldbejust5.//one.6.thrownewMmsException("Nullmessagebodyorhavemultipledestinations・");7.}8.SmsManag
2、ersmsManager=SmsManager.getDefaultO;9.ArrayListmessages二null;10.if((MmsConfig.getEmai1Gateway()!=null)&&11.(Mms.isEmailAddress(mDest)
3、
4、MessageUtils・isAliss(mDest))){12.StringmsgText;13.msgText=mDest+〃"+mMessageText;14.mDest二MmsConfig.getEmaiIGateway();15.message
5、s=smsManagcr.dividcMcssagc(msgText);16.}else{17.messages二SmsManager.divideMessage(mMessageText);18.//removespacesfromdestinationnumber(e.g."8015551212"->"8015551212")19.mDest=mDest.replaceAll(,z“,"");20.}21.intmessageCount=messages,size();22.22.if(messageCount==0){23.//
6、Don'ttrytosendanemptymessage・24.thrownewMmsException("SmsMessageSender.sendMessage:divideMessagereturned"+25."emptymessages.Originalmessageis¥〃〃+mMessageText+〃¥〃“);26.}2&29.booleanmoved=Sms.moveMessageToFolder(mContext,mUri,Sms.MESSAGE_TYPE_OUTBOX,0)■30.if(!moved){31・th
7、rownewMmsException(^SmsMessagcScnder.sendMessagc:couldImovemessage"+32."tooutbox:"+mUri);33.}34.35・ArrayListdelivoryIntcnls=newArrayList(messageCount);36.ArrayList〈PendingTntent>sentTntents=newArrayList(messageCount);37.for(i
8、nti=0;i9、.MessageStatusReceiver.MESSAGE_STATUS_RECEIVED.ACTION,〃底层发出的状态报告消息39.mUri,40.mContext,41.MessageStatusReceiver.class),//接收消息:MessageStatusReceiver.MESSAGE_STATUS_RECE1VED_ACT1ON,49.42.0));43.}44.Intentintent=newIntent(SmsRcceiverService.MESSAGE_SENT_ACT1ON,45.mlJri,46.m10、Context,47.SmsReceiver.class);56.57.intrequestCode=0;58.if(i==messageCount-1){59.//ChangingtherequestCodesotha
9、.MessageStatusReceiver.MESSAGE_STATUS_RECEIVED.ACTION,〃底层发出的状态报告消息39.mUri,40.mContext,41.MessageStatusReceiver.class),//接收消息:MessageStatusReceiver.MESSAGE_STATUS_RECE1VED_ACT1ON,49.42.0));43.}44.Intentintent=newIntent(SmsRcceiverService.MESSAGE_SENT_ACT1ON,45.mlJri,46.m
10、Context,47.SmsReceiver.class);56.57.intrequestCode=0;58.if(i==messageCount-1){59.//ChangingtherequestCodesotha
此文档下载收益归作者所有