1

私は非常に重大な問題に直面しています。通話ログ関連のアプリを開発していますが、コンテンツ プロバイダーから通話ログを取得すると、CallLog.Calls.CACHED_PHOTO_URI が見つかりません。それは常に空に戻っています。VIVO 1917(Funtouch OS_10)を使用しています。

 public static void loadData(Context context) {
    mainList = new ArrayList<>();
    
    String projection[] = {"_id", CallLog.Calls.NUMBER, CallLog.Calls.DATE, CallLog.Calls.DURATION, CallLog.Calls.CACHED_PHOTO_URI, CallLog.Calls.TYPE, CallLog.Calls.CACHED_NAME};
    ContentResolver contentResolver = context.getApplicationContext().getContentResolver();
    Cursor cursor = contentResolver.query(CallLog.Calls.CONTENT_URI, projection, null, null, CallLog.Calls.DEFAULT_SORT_ORDER);

    if (cursor == null) {
        Log.d("CALLLOG", "cursor is null");
        return;
    }

    if (cursor.getCount() == 0) {
        Log.d("CALLLOG", "cursor size is 0");
        return;
    }

    cursor.moveToFirst();
    while (!cursor.isAfterLast()) {
        CallLogInfo callLogInfo = new CallLogInfo();
        callLogInfo.setName(cursor.getString(cursor.getColumnIndex(CallLog.Calls.CACHED_NAME)));
        callLogInfo.setNumber(cursor.getString(cursor.getColumnIndex(CallLog.Calls.NUMBER)));
        callLogInfo.setCallType(cursor.getString(cursor.getColumnIndex(CallLog.Calls.TYPE)));
        callLogInfo.setDate(cursor.getLong(cursor.getColumnIndex(CallLog.Calls.DATE)));
        callLogInfo.setDuration(cursor.getLong(cursor.getColumnIndex(CallLog.Calls.DURATION)));
        String ss = cursor.getString(cursor.getColumnIndex(CallLog.Calls.CACHED_PHOTO_URI));

        Log.e("TAG", "  recent calls " + ss);
        mainList.add(callLogInfo);
        cursor.moveToNext();
    }

    
    cursor.close();
}
4

1 に答える 1