Android 从接收到的彩信中读取数据
如何从收到的彩信中读取数据。 我收到彩信,但无法从中获取任何数据来保存Android 从接收到的彩信中读取数据,android,mms,android-mms,Android,Mms,Android Mms,如何从收到的彩信中读取数据。 我收到彩信,但无法从中获取任何数据来保存 public class MmsReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); String type = intent.getType(); Utils.PrintIn
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);
}
}
}
来自彩信的数据看起来像
数据:???1351504361@mms2+48668822862/TYPE=PLMN
我怎样才能从中得到任何图像我已将图像从其他设备发送到该设备