Skip to content

Commit 976ed49

Browse files
committed
Go back to just using getExternalFilesDirs on Android 11+
getExternalMediaDirs was depreciated in Android 11 since they want people to just contribute to MediaStore directly instead: https://developer.android.com/reference/android/content/Context#getExternalMediaDirs()
1 parent 04f1c5a commit 976ed49

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

app/src/main/java/github/daneren2005/dsub/util/FileUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ public static File getSubsonicDirectory(Context context) {
453453
public static File getDefaultMusicDirectory(Context context) {
454454
if(DEFAULT_MUSIC_DIR == null) {
455455
File[] dirs;
456-
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
456+
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
457457
dirs = context.getExternalMediaDirs();
458458
} else {
459459
dirs = ContextCompat.getExternalFilesDirs(context, null);

app/src/main/java/github/daneren2005/dsub/view/CacheLocationPreference.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected void onBindDialogView(View view) {
6767
Button externalLocation = (Button) cacheButtonsWrapper.findViewById(R.id.location_external);
6868

6969
File[] dirs;
70-
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
70+
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
7171
dirs = context.getExternalMediaDirs();
7272
} else {
7373
dirs = ContextCompat.getExternalFilesDirs(context, null);

0 commit comments

Comments
 (0)