I am using the following to batch delete files.
private void requestDeletePermission(List<Uri> uriList){
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R) {
PendingIntent pi = MediaStore.createDeleteRequest(mActivity.getContentResolver(), uriList);
try {
startIntentSenderForResult(pi.getIntentSender(), REQUEST_PERM_DELETE, null, 0, 0,
0);
} catch (SendIntentException e) { }
}
}
Though, I want to access and have control over the dialog for asking for permission. I want to know when the user taps allow to perform an action and when the deletion finishes to perform another action. Is it possible to control MediaStore.createDeleteRequest() and send the result to a callback interface which I have created? I want my deletion to be decoupled from the UI. I have a separate class for those operations.
P.S. I know I can get the activity result on activity or even using the new API for result but I do not want that.
from Using interface callback with batch files deletion on Android 11
No comments:
Post a Comment