解决:insert Vodafone sim card,open the mms read report,when receive the read report,cann't download..
insert Vodafone sim card,open the mms read report,when receive the read report,cann't download the message
Test steps:
1.insert Vodafone sim card
2.open the mms read report
3.send the mms successfully
4.when receive the read report
这里的环境须要描写叙述一下:在国内不会出现这个问题,该问题在土耳其測试发现,经过分析主要因国内外网络差异导致。
问题大概意思是在国外发送一条彩信。对方成功接收。发送方測试会接收一条阅读报告。
该阅读报告是以彩信的方式接收。这个时候问题来了。彩信无法自己主动下载,点击下载button也无法完毕下载(这里从界面时的确能够这么理解,分析代码之后才发现彩信数据已经下载成功,仅仅是在解析的时候格式不兼容导致解析发生异常,返回null。
)
因此经过分析打开NotificationTransaction.java中的log,从log中得到已经下载好的彩信数据,然后在国内用此模拟数据来解决这个问题。
if (retrieveConfData != null) {(这里加入凝视的意思也就是在这里输出log,得到国外模拟数据,然后在国内进行模拟測试)
//if (Log.isLoggable(LogTag.TRANSACTION, Log.DEBUG)) {
Log.v(TAG, "NotificationTransaction: retrieve data=" +
HexDump.dumpHexString(retrieveConfData));//HexDump这个工具类非常重要。假设有时间大家细致阅读一下源代码(能够将16进制字符串和字节数组进行转换)
//}
当然,终于改动解决这个问题的实在解析pdu和持久化保存的PduParser.java类。
case PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF:
if (LOCAL_LOGV) {
Log.v(LOG_TAG, "parse: MESSAGE_TYPE_RETRIEVE_CONF");
}
RetrieveConf retrieveConf =
new RetrieveConf(mHeaders, mBody);
byte[] contentType = retrieveConf.getContentType();
if (null == contentType) {
if (LOCAL_LOGV)
Log.v(LOG_TAG, "contentType is null");
return null;
}
String ctTypeStr = new String(contentType);
if (LOCAL_LOGV)
Log.v(LOG_TAG, "ctTypeStr is l"+ctTypeStr);
if (ctTypeStr.equals(ContentType.MULTIPART_MIXED)
|| ctTypeStr.equals(ContentType.MULTIPART_RELATED)
|| ctTypeStr.equals(ContentType.TEXT_PLAIN)//这里是加入对“text/plain”格式彩信的兼容
|| ctTypeStr.equals(ContentType.MULTIPART_ALTERNATIVE)) {
// The MMS content type must be "application/vnd.wap.multipart.mixed"
// or "application/vnd.wap.multipart.related"
// or "application/vnd.wap.multipart.alternative"
return retrieveConf;
} else if (ctTypeStr.equals(ContentType.MULTIPART_ALTERNATIVE)) {
// "application/vnd.wap.multipart.alternative"
// should take only the first part.
PduPart firstPart = mBody.getPart(0);
mBody.removeAll();
mBody.addPart(0, firstPart);
return retrieveConf;
}
return null;
以下这发现异常的时候忽视异常:
protected static PduBody parseParts(ByteArrayInputStream pduDataStream) {
if (pduDataStream == null) {
if (LOCAL_LOGV)
Log.v(LOG_TAG, "pduDataStream is null");
return null;
}
int count = parseUnsignedInt(pduDataStream); // get the number of parts
PduBody body = new PduBody();
for (int i = 0 ; i < count ; i++) {
int headerLength = parseUnsignedInt(pduDataStream);
int dataLength = parseUnsignedInt(pduDataStream);
PduPart part = new PduPart();
int startPos = pduDataStream.available();
if (startPos <= 0) {
// Invalid part.
return body;//这里原本是返回null
}
/* parse part's content-type */
HashMap<Integer, Object> map = new HashMap<Integer, Object>();
byte[] contentType = parseContentType(pduDataStream, map);
if (null != contentType) {
part.setContentType(contentType);
} else {
if (LOCAL_LOGV)
Log.v(LOG_TAG, "contentType isn't null");
part.setContentType((PduContentTypes.contentTypes[0]).getBytes()); //"*/*"
}
/* get name parameter */
byte[] name = (byte[]) map.get(PduPart.P_NAME);
if (null != name) {
part.setName(name);
}
else{
if (LOCAL_LOGV)
Log.v(LOG_TAG, "name isn't null");
}
/* get charset parameter */
Integer charset = (Integer) map.get(PduPart.P_CHARSET);
if (null != charset) {
part.setCharset(charset);
}
else{
if (LOCAL_LOGV)
Log.v(LOG_TAG, "charset isn't null");
}
/* parse part's headers */
int endPos = pduDataStream.available();
int partHeaderLen = headerLength - (startPos - endPos);
if (partHeaderLen > 0) {
if (false == parsePartHeaders(pduDataStream, part, partHeaderLen)) {
// Parse part header faild.
if (LOCAL_LOGV)
Log.v(LOG_TAG, "Parse part header faild.");
//return null;
}
} else if (partHeaderLen < 0) {
// Invalid length of content-type.
if (LOCAL_LOGV)
Log.v(LOG_TAG, "Invalid length of content-type.");
//return null;
}
/* FIXME: check content-id, name, filename and content location,
* if not set anyone of them, generate a default content-location
*/
if ((null == part.getContentLocation())
&& (null == part.getName())
&& (null == part.getFilename())
&& (null == part.getContentId())) {
part.setContentLocation(Long.toOctalString(
System.currentTimeMillis()).getBytes());
}
/* get part's data */
if (dataLength > 0) {
byte[] partData = new byte[dataLength];
String partContentType = new String(part.getContentType());
pduDataStream.read(partData, 0, dataLength);
if (partContentType.equalsIgnoreCase(ContentType.MULTIPART_ALTERNATIVE)) {
// parse "multipart/vnd.wap.multipart.alternative".
PduBody childBody = parseParts(new ByteArrayInputStream(partData));
// take the first part of children.
part = childBody.getPart(0);
} else {
// Check Content-Transfer-Encoding.
byte[] partDataEncoding = part.getContentTransferEncoding();
if (null != partDataEncoding) {
String encoding = new String(partDataEncoding);
if (encoding.equalsIgnoreCase(PduPart.P_BASE64)) {
// Decode "base64" into "binary".
partData = Base64.decodeBase64(partData);
} else if (encoding.equalsIgnoreCase(PduPart.P_QUOTED_PRINTABLE)) {
// Decode "quoted-printable" into "binary".
partData = QuotedPrintable.decodeQuotedPrintable(partData);
} else {
// "binary" is the default encoding.
}
}
else{
if (LOCAL_LOGV)
Log.v(LOG_TAG, "partDataEncoding isn't null");
}
if (null == partData) {
log("Decode part data error!");
return null;
}
else{
if (LOCAL_LOGV)
Log.v(LOG_TAG, "partData isn't null");
}
part.setData(partData);
}
}
if(LOCAL_LOGV)
Log.v(LOG_TAG,"checkPartPosition is "+checkPartPosition(part));
/* add this part to body */
if (THE_FIRST_PART == checkPartPosition(part)) {
/* this is the first part */
body.addPart(0, part);
} else {
/* add the part to the end */
body.addPart(part);
}
}
return body;
}
版权声明:本文博主原创文章,博客,未经同意不得转载。
解决:insert Vodafone sim card,open the mms read report,when receive the read report,cann't download..的更多相关文章
- 解决:insert Vodafone sim card,open the mms read report,when receive the read report,cann't download..
insert Vodafone sim card,open the mms read report,when receive the read report,cann't download the m ...
- Windows 10 - View SIM Card Number
If your device isn't running Windows 10, refer to the Windows 8 instructions. From the Windows desk ...
- 在Debian8.3中解决Odoo出现的问题:Unable to find Wkhtmltopdf on this system. The report will be shown in html.
解决Odoo出现的问题:Unable to find Wkhtmltopdf on this system. The report will be shown in html. 下载wkhtmltop ...
- 解决insert语句插入时,需要写列值的问题
今天发现解决这个问题其实很简单,闲话不多谈,我直接附上语句 ) select @s = isnull(@s+',', '') + [name] from syscolumns where id = o ...
- 论山寨手机与Android联姻 【8】 自己动手做XP手机
2010年1月20日,ViewSonic在北京发布了一款真正意义的电脑手机VCP08.根据商家的宣传,VCP08之所以能够被称为真正的电脑手机,是因为“该机做到了把真正的WindowsXP操作系统嵌入 ...
- Arduino 3g shield using GSM bought from ITead
This is an old arduino 3G module bought half years ago. Its wiki: http://wiki.iteadstudio.com/ITEAD_ ...
- android之GMS认证
来到了新的公司,才知道做手机是须要做GMS认证的.于是从一个从没有做过GMS认证的小白到一个月做了8个项目的GMS认证.最后.自己都是吐了.每天晚上都是一个人傻傻在加班.更是知道了高通的支持力度让人发 ...
- mysql insert一条记录后怎样返回创建记录的主键id,last_insert_id(),selectkey
mysql插入数据后返回自增ID的方法 mysql和oracle插入的时候有一个很大的区别是,oracle支持序列做id,mysql本身有一个列可以做自增长字段,mysql在插入一条数据后,如何能获得 ...
- [OrangePi] Backup internal EMMC to SD Card
Boot your Orange PI board from EMMC without SD Card inserted login insert your SD Card Run: sudo ins ...
随机推荐
- x264代码剖析(十五):核心算法之宏块编码中的变换编码
x264代码剖析(十五):核心算法之宏块编码中的变换编码 为了进一步节省图像的传输码率.须要对图像进行压缩,通常採用变换编码及量化来消除图像中的相关性以降低图像编码的动态范围.本文主要介绍变换编码的相 ...
- 谁要的手机用KRKR2 Onscripter 资源打包工具
本软件能够把你手机上指定文件夹打包为文字冒险游戏资源文件 支持打包 1.Onscripter 的NSA格式 2.吉里吉里2(KRKR2)的XP3.(分2.29曾经的旧版本号和2.30以后新版本号) 3 ...
- 可视化格式模型(visual formatting model)
原文 简书原文:https://www.jianshu.com/p/7632f16ff555 大纲 1.认识可视化模型 2.可视化模型的内容 3.可视化模型的影响因素 1.认识可视化模型 盒子模型是C ...
- css3-11 如何让html中的不规则单词折行
css3-11 如何让html中的不规则单词折行 一.总结 一句话总结:用word-wrap属性:word-wrap:break-word; 1.word-break和word-wrap的区别? 推荐 ...
- 【u116】最短路计数
Time Limit: 1 second Memory Limit: 128 MB [问题描述] 给出一个N个顶点M条边的无向无权图,顶点编号为1-N.问从顶点1开始,到其他每个点的最短路有几条. [ ...
- image-base64互转
package base64StringToImage; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStrea ...
- php正则表达式函数
$zz = '/^\d{1,}$/'; //上面的这种方式没问题,还有一种方式经测试也没问题,如下 echo preg_match($zz, "123423423423");//比 ...
- Nginx的一些介绍
Apacheserver:http://httpd.apache.org,世界上用的最多的server,开放源码.支持跨平台,可移植性,模块支持丰富,虽速度和性能及内存消耗不及其它轻量级Webserv ...
- Android JNI编程(一)——JNI概念以及C语言Dev-C++开发环境搭建、编写HelloWorld
版权声明:本文出自阿钟的博客,转载请注明出处:http://blog.csdn.net/a_zhon/. 目录(?)[+] 一:JNI是什么呢? JNI:JNI是JavaNative Interfac ...
- js进阶 11-9/10/11 jquery创建和插入节点
js进阶 11-9/10/11 jquery创建和插入节点 一.总结 一句话总结: 1.jquery插入节点8个方法? 内部之前,内部之后,之前,之后:各两个 append()和appendTo() ...