Android MMS Parsing

2019-08-23 14:44发布

问题:

In one of my application, I have to parse the MMS content. I am able to get the encoded MMS content in the form of byte[]. Now I have to decode this byte[] and need to extract all the content based on their content types and header values. But I am struggling here. I don't know how to start decoding...

Any help will be appreciated.

回答1:

you have the content in byte[] so you can try this:

byte[] 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);
}

you can continue to parse like this.