mms 메시지를 보내고받을 때이를 감지하고 내용을 캡처 할 앱을 만듭니다. "content : // mms-sms/conversations"에 contentResolver를 사용하여이 작업을 수행하고 있습니다. 이것이 트리거되면 마지막 회신 (방금 보낸)을 찾기 위해 대화를 반복합니다. 모든 장치에 대해 커서를 설정할 때 "content : // mms-sms/conversations"가 작동하지 않았기 때문에 "content : // mms-sms/conversations? simple = true"를 사용하고 있습니다. 목록에서 첫 번째 대화를 찾은 다음 목록에서 date desc로 정렬 한 다음 contentResolver.query (uri, Uri.Parse ("content : // mms/part")를 사용하여 실제 내용을 가져 오기 위해 _id를 전달합니다. , selectionPart, null, null); 그러나이 커서를 사용하여 반복 할 때 대화 ID에 대한 레코드가 없습니다. 단순히 mms 보내거나받은 및 정보를 얻을 때 검색하려고 오전. 이에 다양한 주제를 본 적이 있지만 아무것도 문제를 해결하는 것 같았다 없다. 어떤 아이디어? 감사contentResolver를 사용하여 android에서 캡처하는 mms 관련 문제
public void getMMS(Context context)
{
SentinelService.grabbingMMS = false;
boolean sent, startup;
final String[] projection = new String[] { "*" };
Uri uri = Uri.parse("content://mms-sms/conversations?simple=true");
Cursor cursor = contentResolver.query(uri, null, null, null, "_date DESC");
if (cursor.moveToFirst()) {
do
{
String id = cursor.getString(cursor.getColumnIndex("_id"));
String d = cursor.getString(cursor.getColumnIndex("date"));
MMSLog mmsLog = buildMMSLog(id, sent);
} while (cursor.moveToNext());
}
private MMSLog buildMMSLog(String mmsID, boolean sent)
{
String body = "", partID = "", imageString = null, type = "", tempType = "", selectionPart = "mid=" + mmsID;
Bitmap bitmap = null;
Uri uri = Uri.parse(MMS_PART);
Cursor cursor = contentResolver.query(uri, null, selectionPart, null,
null);
if (!cursor.isAfterLast()) {
String[] s = cursor.getColumnNames();
partID = cursor.getString(cursor.getColumnIndex("_id"));
tempType = cursor.getString(cursor.getColumnIndex("ct"));
if ("text/plain".equals(tempType)) {
String data = cursor.getString(cursor.getColumnIndex("_data"));
if (data != null) {
body = getMMSText(partID);
} else {
body = cursor.getString(cursor.getColumnIndex("text"));
}
} else if ("image/jpg".equals(tempType)
|| "image/gif".equals(tempType)
|| "image/jpeg".equals(tempType)
|| "image/bmp".equals(tempType)
|| "image/png".equals(tempType)) {
bitmap = getMMSImage(partID);
type = tempType;
}
}
try {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(CompressFormat.JPEG, 50, stream);
bitmap.recycle();
byte[] byteArray = stream.toByteArray();
stream = new ByteArrayOutputStream();
imageString = new String(Base64.encodeBase64(byteArray));
}
catch (Exception ex) {
}
return new MMSLog(getAddressNumber(mmsID, sent), body, imageString,
type, sent);
}