从接收到的mms读取数据

时间:2014-12-01 11:30:48

标签: android mms android-mms

我如何从收到的mms读取数据。 我收到了一个mms,但我无法从中获取任何数据来保存它

public class MmsReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
    String action = intent.getAction();
    String type = intent.getType();

    Utils.PrintInfo("Action : "+action+", Type : "+type);

        Bundle bundle = intent.getExtras();

        Utils.PrintDebug("bundle " + bundle);

        if (bundle != null) {

            for(String k:bundle.keySet()) {
                Utils.PrintInfo(k);
            }

            byte[] buffer = bundle.getByteArray("data");
            Utils.PrintDebug("buffer " + buffer);
            String incomingNumber = new String(buffer);

            int indx = incomingNumber.indexOf("/TYPE");
            if (indx > 0 && (indx - 15) > 0) {
                int newIndx = indx - 15;
                incomingNumber = incomingNumber.substring(newIndx, indx);
                indx = incomingNumber.indexOf("+");
                if (indx > 0) {
                    incomingNumber = incomingNumber.substring(indx);
                    Utils.PrintDebug("Mobile Number: " + incomingNumber);
                }
            }

            int transactionId = bundle.getInt("transactionId");
            Utils.PrintDebug("transactionId " + transactionId);

            int pduType = bundle.getInt("pduType");
            Utils.PrintDebug("pduType " + pduType);

            byte[] buffer2 = bundle.getByteArray("header");
            String header = new String(buffer2);
            Utils.PrintDebug("header " + header);
        }
}

}

来自该mms的数据看起来像

  

数据:??? 1351504361 @ mms2 ?????? + 48668822862 / TYPE = PLMN ?????????????? http://mmsc.play.pl/?id=1351504361B ??

如何从中获取任何图像? - 我已经将图像从其他设备发送到那个

0 个答案:

没有答案