我想通过applyBatch
方法更新短信机构。我想知道我应该在以下代码中使用哪个AUTHORITY
。我怎样才能将applyBatch()
第一个参数用于短信?
Uri mSmsinboxQueryUri = Uri.parse("content://sms");
ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();
Set<String> keys = map.keySet();
String where = "_id = ?";
for(String k : keys) {
String body = map.get(k);
ops.add(
ContentProviderOperation.newUpdate(mSmsinboxQueryUri).withSelection(where, new String[]{k})
.withValue(Telephony.Sms.BODY, body)
.withYieldAllowed(true)
.build());
}
try {
getContentResolver().
applyBatch(ContactsContract.AUTHORITY, ops);
} catch (RemoteException e) {
e.printStackTrace();
} catch (OperationApplicationException e) {
e.printStackTrace();
}