0

MISSED_CALL ログにアクセスするアプリを開発しています。以下のコードを使用して....

private Cursor getItemsToSync() {
G = "Log method accessing";
ContentResolver r = getContentResolver();

String selections = String.format("%s > ?", CallLog.Calls.DATE,CallLog.Calls.MISSED_TYPE);
String[] selectionArgs = new String[] { String.valueOf(getMaxSyncedDate())};
String sortOrder = SmsConsts.DATE + " LIMIT " + PrefStore.getMaxItemsPerSync(this);
N = CallLog.Calls.CACHED_NAME;
return r.query(Uri.parse("content://call_log/calls"), null,selections,selectionArgs, sortOrder);}

そのすべての通話ログを提供します。MISSED_CALL 通話ログのみを取得する方法を教えてください。前もって感謝します

4

1 に答える 1

2
String[] strFields = {android.provider.CallLog.Calls.CACHED_NAME, android.provider.CallLog.Calls.NUMBER,android.provider.CallLog.Calls.DATE, android.provider.CallLog.Calls.TYPE
    };
    String strOrder = android.provider.CallLog.Calls.DATE + " DESC";

    Cursor mCallCursor = getContentResolver().query(android.provider.CallLog.Calls.CONTENT_URI,strFields, null, null, strOrder);

    if (mCallCursor.moveToFirst()) {

        do {

            boolean missed = mCallCursor.getInt(mCallCursor.getColumnIndex(CallLog.Calls.TYPE)) == CallLog.Calls.MISSED_TYPE;

            if (missed) {

                String name = mCallCursor.getString(mCallCursor
                        .getColumnIndex(CallLog.Calls.CACHED_NAME));

                String number = mCallCursor.getString(mCallCursor
                        .getColumnIndex(CallLog.Calls.NUMBER));
Log.d("PhoneLog", "You have a missed call from " + name + " on " + number // + " at " + time); }

        } while (mCallCursor.moveToNext());

    }
于 2013-06-18T14:31:29.790 に答える