I tried to follow the source code for this and spare the post but I kind of got lost there..
In the old days when we deleted or created a media file using the Java File class we had to notify the OS about it to include it in or remove it from the media database.
Now we kind of have to use the DocumetFile class for some things...This class provides the methods delete()
and createFile(String mimeType, String name)
.
Do we again have to notify the OS using
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE).setData(uri));
for new file and
ContentResolver.delete()
for file removal or the DocumentFile class does it by its self?
The reason I'm asking is because the createFile() method needs the mimeType as input. Makes me think that it will use the mimeType to inform the Media database.