On Samsung phones is com.samsung.android.messaging app pre installed. Android 12.
Intent-filter as such as “sms_received” and “wap_push_received” are not supported anymore.
MMS and SMS are now in “content://im/chat”.
I can fetch body, date, address - but no images.
How to access all image data in (MMS) chat message based on “content://im/chat” data?
public void checkChat(ContentResolver contentResolver) {
Uri uri = Uri.parse("content://im/chat");
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.set(date.getYear(), date.getMonth(), 1, 0, 0);
String selection = "date >= ?";
String [] selectionArgs = {String.valueOf(calendar.getTimeInMillis())};
Cursor cursor = contentResolver.query(uri ,null, selection, selectionArgs, "date DESC LIMIT 40 OFFSET 0");
int count = cursor.getCount();
if(cursor != null){
try{
if (cursor.moveToFirst()) {
do {
String id = cursor.getString(cursor.getColumnIndex("_id"));
String msgId = cursor.getString(cursor.getColumnIndex("msg_id"));
String phone = cursor.getString(cursor.getColumnIndex("address"));
String timestamp = cursor.getString(cursor.getColumnIndex("date"));
String dateTime = DateFormat.format("yyyy-MM-dd HH:mm:ss", new Date(Long.parseLong(timestamp))).toString();
String body = (cursor.getString(cursor.getColumnIndex("body"))+ "..............................").substring(0,30);
// now working - List<Bitmap> bitmaps = getImagesFromMMS(contentResolver, msgId);
System.out.println("###### access CHAT: [" + id + "] " + dateTime + " " + phone + " " + body);
} while(cursor.moveToNext());
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
Any idea?