




已阅读5页,还剩2页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
安卓安卓 CDMA 超长短信发送超长短信发送 首先调用 mWorkingMessage send 发送短信 mWorkingMessage send 不用猜测他是什么你就当作是 Button 的 OnClick 把 mWorkingMessage send if Log isLoggable LogTag TRANSACTION Log VERBOSE LogTag debug send Get ready to write to disk prepareForSave true notify We need the recipient list for both SMS and MMS final Conversation conv mConversation String msgTxt mText toString if requiresMms addressContainsEmailToMms conv msgTxt Make local copies of the bits we need for sending a message because we will be doing it off of the main thread which will immediately continue on to resetting some of this state 使我们的比特的信息需要发送一个本地副本 因为我们将做它关闭了主线程 这将 立即继续以这种状态重置一些 final Uri mmsUri mMessageUri final PduPersister persister PduPersister getPduPersister mContext final SlideshowModel slideshow mSlideshow final SendReq sendReq makeSendReq conv mSubject Make sure the text in slide 0 is no longer holding onto a reference to the text in the message text box slideshow prepareForSend Do the dirty work of sending the message off of the main UI thread new Thread new Runnable public void run sendMmsWorker conv mmsUri persister slideshow sendReq start else Same rules apply as above final String msgText mText toString new Thread new Runnable public void run sendSmsWorker conv msgText 抓住这点继续追查 start update the Recipient cache with the new to address if it s different 更新了新的收 件人地址缓存 如果它的不同 RecipientIdCache updateNumbers conv getThreadId conv getRecipients Mark the message as discarded because it is off the market after being sent mDiscarded true sendSmsWorker conv msgText mStatusListener onPreMessageSent Make sure we are still using the correct thread ID for our recipient set long threadId conv ensureThreadId String dests conv getRecipients getNumbers 获取收件人的号码 try MessageSender sender new SmsMessageSender mContext dests msgText threadId 构造一个 MessageSender sender sendMessage threadId 继续追查数据是怎么发送的 Make sure this thread isn t over the limits in message count Recycler getSmsRecycler deleteOldMessagesByThreadId mContext threadId catch Exception e Log e TAG Failed to send SMS message threadId threadId e mStatusListener onMessageSent 一个默认的构造函数 没有什么特别的地方 public SmsMessageSender Context context String dests String msgText long threadId mContext context mMessageText msgText mNumberOfDests dests length mDests new String mNumberOfDests System arraycopy dests 0 mDests 0 mNumberOfDests mTimestamp System currentTimeMillis mThreadId threadId mServiceCenter getOutgoingServiceCenter mThreadId sender sendMessage threadId if mMessageText null mNumberOfDests 0 Don t try to send an empty message throw new MmsException Null message body or dest SmsManager smsManager SmsManager getDefault 群体发送短信 for int i 0 i mNumberOfDests i ArrayList messages null 将要发送的短信 if MmsConfig getEmailGateway null msgText mDests i mMessageText 对消息组装 我 你好 mDests i MmsConfig getEmailGateway messages smsManager divideMessage msgText else messages smsManager divideMessage mMessageText int messageCount messages size 短信条数 if messageCount 0 Don t try to send an empty message throw new MmsException SmsMessageSender sendMessage divideMessage returned empty messages Original message is mMessageText ArrayList deliveryIntents new ArrayList messageCount ArrayList sentIntents new ArrayList messageCount SharedPreferences prefs PreferenceManager getDefaultSharedPreferences mContext boolean requestDeliveryReport prefs getBoolean MessagingPreferenceActivity SMS DELIVERY REPORT MODE DEFAULT DELIVERY REPORT MODE Uri uri null try uri Sms Outbox addMessage mContext getContentResolver mDests i mMessageText null mTimestamp requestDeliveryReport mThreadId 将要发送的短信添加到数据库中 catch SQLiteException e SqliteWrapper checkSQLiteException mContext e for int j 0 j messageCount j if requestDeliveryReport TODO Fix It should not be necessary to specify the class in this intent Doing that unnecessarily limits customizability deliveryIntents add PendingIntent getBroadcast mContext 0 new Intent MessageStatusReceiver MESSAGE STATUS RECEIVED ACTION uri mContext MessageStatusReceiver class 0 sentIntents add PendingIntent getBroadcast mContext 0 new Intent SmsReceiverService MESSAGE SENT ACTION uri mContext SmsReceiver class 0 if Log isLoggable LogTag TRANSACTION Log VERBOSE log sendMessage address i mDests i threadId mThreadId uri uri msgs count messageCount try smsManager sendMultipartTextMessage 该是核心发送模块了吧 结果失 望了 mDests i mServiceCenter messages sentIntents deliveryIntents catch Exception ex throw new MmsException SmsMessageSender sendMessage caught ex from SmsManager sendMultipartTextMessage return false smsManager sendMultipartTextMessage mDests i mServiceCenter messages sentIntents deliveryIntents String destinationAddress 对方地址 String scAddress 消息中心 ArrayList parts 消息 不过是大块的分成小块的啦 ArrayList sentIntents ArrayList deliveryIntents if TextUtils isEmpty destinationAddress throw new IllegalArgumentException Invalid destinationAddress if parts null parts size 1 try ISms iccISms ISms Stub asInterface ServiceManager getService isms if iccISms null iccISms sendMultipartText destinationAddress scAddress parts sentIntents deliveryIntents catch RemoteException ex ignore it else PendingIntent sentIntent null PendingIntent deliveryIntent null if sentIntents null if deliveryIntents null sendTextMessage destinationAddress scAddress parts get 0 sentIntent deliveryIntent 继续追查 ing sendTextMessage destinationAddress scAddress parts get 0 sentIntent deliveryIntent String destinationAddress String scAddress String text PendingIntent sentIntent PendingIntent deliveryIntent if TextUtils isEmpty destinationAddress throw new IllegalArgumentException Invalid destinationAddress if TextUtils isEmpty text throw new IllegalArgumentException Invalid message body try ISms iccISms ISms Stub asInterface ServiceManager get
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 高职体育教育教学改革的路径研究
- 2024年高升专模拟试题及参考答案详解【完整版】
- 2025年社区工作人员综合提升测试卷及完整答案详解一套
- 2023年度园林绿化作业人员考前冲刺练习题含答案详解(模拟题)
- 执业药师之《西药学专业一》强化训练题型汇编带答案详解(培优)
- 2025年海南省五指山市中考数学复习提分资料A4版附答案详解
- 绿色金融项目可行性研究与风险评估报告
- 合同协议委托培训合同4篇
- 2024自考专业(金融)常考点试卷附参考答案详解【达标题】
- 2025年自考专业(教育管理)测试卷含答案详解【培优B卷】
- 高压电气设备试验的基本知识
- 整理我的小书桌(课件)小学劳动二年级通用版
- 激光束传输与变换-第九讲课件
- 时空大数据讲义课件
- 2023年上海国企中远海运(上海)有限公司招聘笔试题库含答案解析
- 管工安全技术操作规程
- 曲臂车高空作业车施工方案
- 武汉某厂房设备基础施工方案
- 第4部分 质量经理-质量管理体系章节题-43题附有答案
- DL-T 736-2021 农村电网剩余电流动作保护器安装运行规程
- GB/T 3836.1-2021爆炸性环境第1部分:设备通用要求
评论
0/150
提交评论