Skip to content

Commit

Permalink
Go back to just using getExternalFilesDirs on Android 11+
Browse files Browse the repository at this point in the history
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()
  • Loading branch information
daneren2005 committed Sep 12, 2020
1 parent 04f1c5a commit 976ed49
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ public static File getSubsonicDirectory(Context context) {
public static File getDefaultMusicDirectory(Context context) {
if(DEFAULT_MUSIC_DIR == null) {
File[] dirs;
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
dirs = context.getExternalMediaDirs();
} else {
dirs = ContextCompat.getExternalFilesDirs(context, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected void onBindDialogView(View view) {
Button externalLocation = (Button) cacheButtonsWrapper.findViewById(R.id.location_external);

File[] dirs;
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
dirs = context.getExternalMediaDirs();
} else {
dirs = ContextCompat.getExternalFilesDirs(context, null);
Expand Down

0 comments on commit 976ed49

Please sign in to comment.