[转+原创]How to edit the max sending size for MMS in Android

转贴部分:

http://www.connect-utb.com/index.php?option=com_content&view=article&id=354%3Ahow-to-edit-the-max-sending-size-for-mms-in-android&catid=36%3Atechnology&Itemid=67

How to edit the max sending size for MMS in Android

Written by Edvard

Monday, 12 April 2010 04:12

android_mmsAndroid 2.1 on the Nexus One currently has an issue with image compression for MMS The default sms/mms client in Android does compress images, but it doesnt compress enough. It compresses all images so that it has a maximum image size of 2592×1944. However, for many carriers, the file size limit is around 300kb which will make you unable to send the MMS.

Luckily, there is a quick and easy way to manually edit the max sending size value..

The first thing you need is the Android SDK so that you can ADB your device. Also note that your device needs to be rooted, as you need to be root in order to push the mms.apk back in. After the SDK is installed, connect your phone to your computer and use the command prompt or terminal to pull your Mms.apk from your device.

NOTE: your device needs to be rooted for this to work..

adb devices
adb remount
adb pull /system/app/Mms.apk Mms.apk

This will give you a local copy of the Mms.apk. You now need to open it using a archive manager such as WinRAR og 7-ZIP.

Then navigate to res>xml>mms_config.xml, and open it in your favorite binary editor..

The limits are clearly visible as ASCII text in there. As the limit is 1048576, you need to make that 0307200 to be on the safe side. I also edited the resolution, 1024×768 would seem plenty for an MMS. The result is that outgoing messages here are around 100kb when resized and it never hits that 300KB limitation. Picture below shows the file after I did the changes described above.

mms

Now just save the file and close your binary editor then update the .apk file. Note that the .apk is basically just a zip archive so no special tools are needed but the easiest way is to is to use an archiver that lets you open the .apk, edit the file and close it. No need to extract and repack.

Now all you have to do is to push the .apk back to your device.

adb push Mms.apk system/app
adb reboot

Now the change is in effect and your MMS should send just fine!

Note that there is no need to go through this if you dont have any issues with sending MMS. But there are potentially many different reasons why you would want to edit the MMS settings and now you know how :)

Last Updated ( Tuesday, 13 April 2010 10:52 )


 

原创部分:

如何修改Android系统中,发送彩信时压缩图片的大小

参考上面转载的文章,以下将解决Android手机系统的一个问题:在发送彩信时,图片压缩不充分,导致图片文件太大,超过了中国移动的发送限制(最大300KB),在发送过程进行到一半时终止,并收到短信:尊敬的用户,您刚才提交的彩信失败,因为消息大小超过系统限制307200字节(短信文字内容来自Google,我的四川移动显示300KB不是307200)。

在Mms.apk程序的前台界面中,找不到有关彩信发送大小的设置,因此直接设置是不可能的。在Google中搜索中文信息,没有解决办法;而搜索英文信息,就有了上面的帖子。外语好的朋友可以直接按照上面的去做,只不过adb部分需要参考一下后面。

修改原理(小白可以跳过):Mms.apk中包含一个名为mms_config.xml的配置文件,其中就指定了彩信发送时,图片的压缩规格,包括文件大小、图像尺寸(长和宽最大值)的限制,且都按照Big-Endian ASCII存放在文件中,这样我们可以直接用UltraEdit之类的HEX编辑软件做修改,最后替换软件包即可。

实现步骤:

Step 0. 警告:以下操作将修改Android系统服务,不恰当的操作有可能导致手机不能正常工作,包括但不限于:短信息/彩信不能正确接收/发送;系统运行速度变慢;系统频繁死机或无法启动;机存短信被清空。所有操作的成功与否,将取决于用户“您”的行为,本文作者不为所述方法其安全性、稳定性与正确性提供担保。

Step 1. 获取原版Mms.apk:adb pull /system/app/Mms.apk Mms.apk  注意大小写(比如要是写了mms.apk会提示文件不存在)。

Step 2. 备份Mms.apk。

Step 3. 用WinRAR等压缩软件打开apk。按照上面转载的文章所述,这里也建议在WinRAR中直接打开文件修改,从而不必再次打包。需要使用WinRAR的“外部查看器”功能,步骤如下。其他语言的WinRAR或其他压缩软件,请参考以下步骤做类似更改,或者先解压,修改后再重新打包。
—–Step 3.1. 按照下图示意,为WinRAR添加“外部查看器”功能。
Step_2_1 —–Step 3.2. 打开Mms.apk,找到res\xml\mms_config.xml文件,双击,在弹出的对话框中选择“外部 查看器”,即可启动UltraEdit,如下图所示。注意:打开文本编辑器后,WinRAR要保持打开状态,不能关闭
Step_2_2
Step 4. 修改mms_config.xml。如果用的是UltraEdit,要使用HEX编辑模式,以保证能够正确修改。“VmaxMessageSize”指定彩信最大的字节数,可以看到系统默认为1048576也就是1MB。中国移动限制彩信大小为300KB,那么就改成0307200,注意第一位是0。修改数字的时候不能改变其他位的信息,包括那些点点(对应16位半字中的低8位),就像转载文章中的图一样。后面的maxImageHeight和maxImageWidth是指定压缩后图片的最大宽或高(取决于被压缩图片的长和宽,最大的数值要满足这里的限制),转载作者修改为1024×768,我建议改成1600×1200(两百万像素)。

Step 5. 关闭HEX编辑器,这时WinRAR弹出提示询问是否重新压缩以应用更改(你的没有?前面的文字没有仔细阅读完整吧!重新来过!),点“是”,WinRAR会自动重新打包。这时要看一下新的压缩文件,如果有mms_config.xml.bak文件,这是UltraEdit等HEX编辑软件自动生成的备份文件,就需要删除,点击工具栏上或菜单中的“删除”命令即可删除,WinRAR还会在自动压缩一次。这时,修改工作已经完成,关闭WinRAR。

Step 6. 将Mms.apk复制回手机,因为adb remount功能在正式版本的Android上已经不能使用,因此要先把修改后的Mms.apk复制到SD卡,然后再用手机浏览器做替换工作。
—–Step 6.1. PC端操作:adb push Mms.apk sdcard/Mms.apk
—–Step 6.2. 手机端操作:打开RE,去SD卡根目录,找到Mms.apk,复制,再去/system/app,先挂载r/w,(这时应该顺手备份一下原版程序:保持复制/粘贴的界面不要动,找到原版的Mms.apk,长按呼出菜单,选“重命名”再给文件名添加个.bak后缀),然后点“粘贴”。
—–Step 6.3. 不要忘了修改权限(我自己做的时候信息图标就变蓝板了,吓死我了):找到新复制的Mms.apk,长按呼出菜单,修改权限为777(就是九个钩)。退出RE,不要再动手机。
—–Step 6.4. PC端操作:adb reboot。等待手机重启。

至此,修改工作已经完成。等待重启完成之后,短信息应该是原封未动的。但是这时运行的信息程序,已经是你修改之后的了。尝试发送一下以前发不出去的图片,现在能不能工作了?

– END –

Advertisements
  1. 留下评论

Log in or fill out contact info to leave a reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: