2012-02-09 7 views
0

SMS 로그를 검색하려면 어떻게해야합니까? 나는 가장 최근에 전화로 SMS 메시지를 보냈거나 전화로받은 연락처 목록을 얻을 수 있기를 원합니다.SMS 로그를 검색하려면 어떻게해야합니까?

CallLogs 개체가 발견되었지만 전화 통화에서만 작동합니다 ... 제가 틀린 경우 제발 정정하십시오.

http://www.dcpagesapps.com/developer-resources/android/25-android-tutorial-call-logs

http://developer.android.com/reference/android/provider/CallLog.Calls.html 나는이를 찾았지만, 더 나은 방법이 있는지 나는

Android 1.5: Reading SMS messages

+0

어떤 아이디어가 마지막 몇 SMS 메시지를 보냈는지 확인하는 방법은 무엇입니까? – ycomp

답변

0

죄송합니다 .... 궁금했지만, 아무것도 안드로이드에 없다 SDK는 "SMS 로그"와 관련이 있습니다.

1

이것은 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(); 

} 
관련 문제