이것은 SMS를받는 나의 방법이며 효과가 좋습니다. 보내고받을 로그가 따로 있습니다. 특정 타사 SMS 프로그램 메시지가 표시되지 않을 수 있습니다. phoneNumbers라는 문자열의 숫자에서 보내거나받은 SMS를 찾고 처리 된 배열에 발견 된 SMS 메시지를 모두 추가합니다.
public void getSMS(){
final String[] projection = null;
final String selection = "address IN (" + phoneNumbers + ")";
final String selectionArgs[] = null;
final String sortOrder = null;
Cursor c = null;
c = getContentResolver().query(
Uri.parse("content://sms/sent"),
projection,
selection,
selectionArgs,
sortOrder);
if (c.moveToFirst() && c.isNull(c.getColumnIndex("date"))==false && c.isNull(c.getColumnIndex("address"))==false) {
do {
CCall call = new CCall(c.getLong(c.getColumnIndex("date")),c.getString(c.getColumnIndex("address")),4,0);
arrCall.add(call);
} while (c.moveToNext());
}
c = getContentResolver().query(
Uri.parse("content://sms/inbox"),
projection,
selection,
selectionArgs,
sortOrder);
if (c.moveToFirst() && c.isNull(c.getColumnIndex("date"))==false && c.isNull(c.getColumnIndex("address"))==false) {
do {
CCall call = new CCall(c.getLong(c.getColumnIndex("date")),c.getString(c.getColumnIndex("address")),5,0);
arrCall.add(call);
} while (c.moveToNext());
}
c.close();
}
어떤 아이디어가 마지막 몇 SMS 메시지를 보냈는지 확인하는 방법은 무엇입니까? – ycomp