in the app I developed I recover call logs by a method. In particular I am interested in the date, number, duration and type call. The app has been deployed on approximately 600 devices. On almost all of them it works fine, on tcl phones I have problems retrieving the logs.
On the phones where I encounter the problem I have this type of error:
no such column: verstat (code 1 SQLITE_ERROR): , while compiling: SELECT date, phone_account_hidden, is_private, verstat, transcription, photo_id, IsEccNumber, subscription_component_name, subject, call_screening_app_name, indicate_phone_or_sim_contact, type, geocoded_location, presentation, duration, subscription_id, is_read, number, features, voicemail_uri, normalized_number, is_sdn_contact, composer_photo_uri, via_number, matched_number, last_modified, new, numberlabel, missed_reason, lookup_uri, photo_uri, data_usage, phone_account_address, formatted_number, add_for_all_users, block_reason, priority, numbertype, call_screening_component_name, conference_call_id, rat_type, countryiso, name, post_dial_digits, transcription_state, location, calls._id as _id FROM calls WHERE (((type != 4)) AND ((phone_account_hidden = 0))) ORDER BY date DESC
My method is:
public List<RegistryCall> readCalls(Boolean readLastCall) {
List<RegistryCall> registryCalls = new ArrayList<>();
ContentResolver cr = context.getContentResolver();
Cursor managedCursor = cr.query(CallLog.Calls.CONTENT_URI, null, null, null, android.provider.CallLog.Calls.DATE + " DESC");
int callIdColumn = managedCursor.getColumnIndex(CallLog.Calls._ID);
int numberColumn = managedCursor.getColumnIndex(CallLog.Calls.NUMBER);
//INCOMING_TYPE = 1 , OUTGOING_TYPE = 2 , MISSED_TYPE = 3 ,REJECTED_TYPE = 5
int typeColumn = managedCursor.getColumnIndex(CallLog.Calls.TYPE);
int dateColumn = managedCursor.getColumnIndex(CallLog.Calls.DATE);
int durationColumn = managedCursor.getColumnIndex(CallLog.Calls.DURATION);
if ((managedCursor != null ? managedCursor.getCount() : 0) > 0) {
while (managedCursor != null && managedCursor.moveToNext()) {
String callLogID = managedCursor.getString(callIdColumn);
String phNumber = managedCursor.getString(numberColumn);
String callType = managedCursor.getString(typeColumn);
String callDate = managedCursor.getString(dateColumn);
LocalDateTime localDate = DateTimeHelper.dateToLocalDateTime(new Date(Long.valueOf(callDate)));
String callDuration = managedCursor.getString(durationColumn);
RegistryCall registryCallSingle = new RegistryCall(callLogID, phNumber, callType, localDate, callDuration);
registryCalls.add(registryCallSingle);
if (readLastCall) {
break;
}
}
}
return registryCalls;
}
The line 33 is this row in the code: Cursor managedCursor = cr.query(CallLog.Calls.CONTENT_URI, null, null, null, android.provider.CallLog.Calls.DATE + " DESC"); It seems that the phones model where the problem is are TCL with Android 12. Could anyone help me? Thanks