삭제 된 연락처를 복구 할 수있는 앱을 만들고 싶습니다. 다른 모든 장치에서 작동하지만 Android 10에서는 응용 프로그램이 삭제 된 연락처를 가져올 수 없습니다. 안드로이드 10에서 삭제 된 연락처를 얻는 해결책이 있습니까?
삭제 된 연락처를 복구 할 수있는 내 코드는 다음과 같습니다.
public static final String WHERE_MODIFIED1 = "( " + ContactsContract.RawContacts.DELETED + "=1)";
ContentResolver cr = getContentResolver();
Cursor cur = cr.query((ContactsContract.RawContacts.CONTENT_URI),
null, WHERE_MODIFIED1, null, (DeletedContactRecovery.hasHoneycomb() ? "sort_key" : "display_name") + " COLLATE LOCALIZED ASC");
assert cur != null;
if (cur.getCount() > 0) {
while (cur.moveToNext()) {
String id = cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID));
String name = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
String phone = null;
//if (!(Integer.parseInt(cur.getString(cur.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0)) {
System.out.println("name : " + name + ", ID : " + id);
// get the phone number
Cursor pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?",
new String[]{id}, null);
assert pCur != null;
while (pCur.moveToNext()) {
phone = pCur.getString(
pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
System.out.println("phone" + phone);
}
pCur.close();
//}
if (id != null) {
contactList.add(new Contact(name, phone, id));
}
Log.e("hvy", "onCreaterrView Phone Number: name = " + name
+ " No = " + phone);
}
}
cur.close();
Android 앱에서 연락처를 차단하거나 복구하려면 기본 Dailer 또는 SMS 앱으로 설정해야합니다. 내 앱이 Android 10 아래에서 완벽하게 작동하더라도 Android 10에서 블록 연락처를 읽는 데 지쳤을 때 동일한 문제가 발생했습니다. 여기에서 해결책이 무엇인지 정확히 모르겠지만 앱을 기본값으로 설정 한 다음 시도해보세요. 연락처를 읽으십시오.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다