大家好日子!!!
我们可以使用CallLog.AUTHORITY
删除通话记录。这是一个删除调用的实用方法......
public static void deleteCallLogsFromNative(Context context, long[] rowIds) {
ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>(
rowIds.length);
for (int i = 0, N = rowIds.length; i < N; i++) {
operations.add(ContentProviderOperation
.newDelete(CallLog.Calls.CONTENT_URI)
.withSelection(CallLog.Calls._ID + " = ?",
new String[] { String.valueOf(rowIds[i]) }).build());
}
try {
context.getContentResolver().applyBatch(CallLog.AUTHORITY,
operations);
} catch (Exception e) {
Log.e(TAG,
"Error while deleting calls from native: " + e.toString());
}
}
您可以观察到,对于应用批处理操作,我们需要一个AUTHORITY,这里需要CallLog.AUTHORITY
来删除通话记录。
同样,我还有另一种删除邮件的实用方法......
public static void deleteMessagesFromNative(Context context, long[] rowIds) {
ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>(
rowIds.length);
for (int i = 0, N = rowIds.length; i < N; i++) {
long rowId = rowIds[i];
operations.add(ContentProviderOperation
.newDelete(Uri.parse("content://sms/"))
.withSelection(BaseColumns._ID + " = ?",
new String[] { String.valueOf(rowId) }).build());
}
try {
// here I need AUTHORITY value for deleting messages
} catch (Exception e) {
// TODO: handle exception
}
}
现在我的问题是,AUTHORITY
删除邮件的价值是多少?