public void SMSList() {
try {
// Retrieve All SMS
/*
Inbox = "content://sms/inbox"
Failed = "content://sms/failed"
Queued = "content://sms/queued"
Sent = "content://sms/sent"
Draft = "content://sms/draft"
Outbox = "content://sms/outbox"
Undelivered = "content://sms/undelivered"
All = "content://sms/all"
Conversations = "content://sms/conversations"
addressCol= mCurSms.getColumnIndex("address");
personCol= mCurSms.getColumnIndex("person");
dateCol = mCurSms.getColumnIndex("date");
protocolCol= mCurSms.getColumnIndex("protocol");
readCol = mCurSms.getColumnIndex("read");
statusCol = mCurSms.getColumnIndex("status");
typeCol = mCurSms.getColumnIndex("type");
subjectCol = mCurSms.getColumnIndex("subject");
bodyCol = mCurSms.getColumnIndex("body");
*/
Uri allMessage = Uri.parse("content://mms-sms/spam-filter");
Cursor cur = this.getContentResolver().query(allMessage, null, null, null, null);
int count = cur.getCount();
for(int i=0;i<count;i++){
Log.i("heylee" , "SMS count = " + count+" "+cur.getColumnName(i));
}
// 04-18 15:26:49.844: I/heylee(17536): SMS count = 4 enable
// 04-18 15:26:49.844: I/heylee(17536): SMS count = 4 filter
// 04-18 15:25:07.684: I/heylee(16355): SMS count = 2 filter_type
String row = "";
String msg = "";
String date = "";
String protocol = "";
while (cur.moveToNext()) {
row = cur.getString(cur.getColumnIndex("_id")); //등록된 순서 대로 ... 부여되는 id 1,2,3,4,....
msg = cur.getString(cur.getColumnIndex("filter_type")); //이게 0이면 스팸 번호, 1이면 스팸문구.
date = cur.getString(cur.getColumnIndex("enable"));
protocol = cur.getString(cur.getColumnIndex("filter")); // 번호 or스팸 문
// Logger.d( TAG , "SMS PROTOCOL = " + protocol);
// String type = "";
// if (protocol == MESSAGE_TYPE_SENT) type = "sent";
// else if (protocol == MESSAGE_TYPE_INBOX) type = "receive";
// else if (protocol == MESSAGE_TYPE_CONVERSATIONS) type = "conversations";
// else if (protocol == null) type = "send";
Log.i( "heylee" , "SMS Phone: " + row + " / Mesg: " + msg + " / Type: " + date + " / Date: " + protocol);
}
} catch (Exception e) {
e.printStackTrace();
}
}
Android Studio 3.0 xml 레이아웃 프리뷰 꺠짐 (0) | 2017.11.11 |
---|---|
휴대폰 SMS 목록 가져오기 코드. (1) | 2016.04.14 |
Google Play Services GCM 변경 후기. (0) | 2013.11.14 |
[안드로이드 ERROR ] SoundPool 사용시 Not active and NO_MORE_BUFFERS (0) | 2012.04.01 |
[안드로이드] 허니컴 state bar 없애기. (0) | 2011.09.20 |
댓글 영역