mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-22 04:59:34 +01:00
avoid Security Exeception from AccountManager
This commit is contained in:
parent
5b6fd3759f
commit
6e885af18c
@ -86,7 +86,9 @@ class ContactAddressBookWorker(val context: Context, workerParameters: WorkerPar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(AccountManager.get(context).getAccountsByType(ACCOUNT_TYPE).isEmpty()){
|
||||||
AccountManager.get(context).addAccountExplicitly(Account(ACCOUNT_NAME, ACCOUNT_TYPE), "", null)
|
AccountManager.get(context).addAccountExplicitly(Account(ACCOUNT_NAME, ACCOUNT_TYPE), "", null)
|
||||||
|
}
|
||||||
|
|
||||||
// collect all contacts with phone number
|
// collect all contacts with phone number
|
||||||
val contactsWithNumbers = collectPhoneNumbers()
|
val contactsWithNumbers = collectPhoneNumbers()
|
||||||
@ -319,9 +321,9 @@ class ContactAddressBookWorker(val context: Context, workerParameters: WorkerPar
|
|||||||
try {
|
try {
|
||||||
context.contentResolver.applyBatch(ContactsContract.AUTHORITY, ops)
|
context.contentResolver.applyBatch(ContactsContract.AUTHORITY, ops)
|
||||||
} catch (e: OperationApplicationException) {
|
} catch (e: OperationApplicationException) {
|
||||||
e.printStackTrace()
|
Log.e(javaClass.simpleName, "", e)
|
||||||
} catch (e: RemoteException) {
|
} catch (e: RemoteException) {
|
||||||
e.printStackTrace()
|
Log.e(javaClass.simpleName, "", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user