안드로이드 개발 질문/답변
(글 수 45,052)
아무리 구글링을 해봐도 문자 메시지를 가져오는 법을 못찾겠네요..ㅠㅠ
특정 문자 메시지를 받아오고 싶은데..
예를 들어
010-5555-5555 한테만 온 문자 메시지들을 따로 가져와서
위 번호의 하나의 문자 메시지의 body를 알아오는 것을 알고 싶습니다.
대충
ContentValues val = new ContentValues();
val.put("address","5556");
val.put("date",new Date(java.lang.System.currentTimeMillis()).toString());
val.put("read", 1);
val.put("status",-1);
val.put("type",2);
val.put("body", "SMS inserting test");
Uri inserted = getContentResolver().insert(Uri.parse("content://sms"), val);
if(inserted!=null){
Toast.makeText(getBaseContext(),
"sms inserted", Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(getBaseContext(),
"sms insert failed", Toast.LENGTH_SHORT).show();
}
//메시지 받아오기
ContentResolver r = getContentResolver();
Cursor result = r.query(Uri.parse("content://sms"), null, null, null,null);
SMS 메세지의 컬럼들은 아래와같은것들이 있다
_id
Thread_id
address
person
date
protocol
read
status
type
reply_path_persent
subject
body
service_center
이런 내용만 있고 어떤 동작 원리인지 모르겠습니다.
mmssms.db에 접근도 해봤습니다.
sqlite viewer로 봐도 비어있구요..
프로바이더로 접근해도 column count는 0
예제 소스 같은 것이 있으면 좋겠습니다.
다시 한번 정리하자면
제 핸드폰에 문자메시지들이 있습니다.
"철수"라는 이름으로 받은 메시지를 필터링 해주고.
그 메시지의 body(본문 내용)를 보여주는 것입니다...
아시는 분 꼭 연락주세요ㅜㅜ



