Use MediaStore.VOLUME_EXTERNAL_PRIMARY when downloading media.

This commit is contained in:
Alex Ning 2021-07-14 20:47:49 +08:00
parent 200f5839ff
commit e2e7a8cdcd
2 changed files with 2 additions and 3 deletions

View File

@ -263,7 +263,7 @@ public class DownloadMediaService extends Service {
contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, destinationFileUriString);
contentValues.put(mediaType == EXTRA_MEDIA_TYPE_VIDEO ? MediaStore.Video.Media.IS_PENDING : MediaStore.Images.Media.IS_PENDING, 1);
final Uri contentUri = mediaType == EXTRA_MEDIA_TYPE_VIDEO ? MediaStore.Video.Media.getContentUri(MediaStore.VOLUME_EXTERNAL) : MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL);
final Uri contentUri = mediaType == EXTRA_MEDIA_TYPE_VIDEO ? MediaStore.Video.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY) : MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY);
Uri uri = contentResolver.insert(contentUri, contentValues);
if (uri == null) {

View File

@ -25,7 +25,6 @@ import android.os.Looper;
import android.os.Message;
import android.os.Process;
import android.provider.MediaStore;
import android.util.Log;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
@ -417,7 +416,7 @@ public class DownloadRedditVideoService extends Service {
Uri uri = null;
try {
final Uri contentUri = MediaStore.Video.Media.getContentUri(MediaStore.VOLUME_EXTERNAL);
final Uri contentUri = MediaStore.Video.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY);
uri = contentResolver.insert(contentUri, contentValues);
if (uri == null) {