Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't download songs into external storage #134

Open
VileoSufora opened this issue Oct 4, 2021 · 11 comments
Open

Can't download songs into external storage #134

VileoSufora opened this issue Oct 4, 2021 · 11 comments

Comments

@VileoSufora
Copy link

VileoSufora commented Oct 4, 2021

Phone: Samsung Note 8
Android Version: 9, the most recent update as of this posting.
Finamp version: 0.5.1

Finamp seems to generate an entry in the download screen when I try to download an album, but it says 0 MB for the size and Finamp throws this error:

[Flutter/SEVERE] 2021-10-03 20:23:28.511681: Null check operator used on a null value

#0      Navigator.of (package:flutter/src/widgets/navigator.dart:2740)
#1      showDialog (package:flutter/src/material/dialog.dart:1064)
#2      errorSnackbar.<anonymous closure> (package:finamp/components/errorSnackbar.dart:12)
#3      _SnackBarActionState._handlePressed (package:flutter/src/material/snack_bar.dart:124)
#4      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:989)
#5      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182)
#6      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:607)
#7      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:296)
#8      BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:267)
#9      GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:157)
#10     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:443)
#11     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:419)
#12     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:287)
#13     GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:374)
#14     GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:338)
#15     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:296)
#16     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:279)
#17     _rootRunUnary (dart:async/zone.dart:1370)
#18     _CustomZone.runUnary (dart:async/zone.dart:1265)
#19     _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170)
#20     _invoke1 (dart:ui/hooks.dart:182)
#21     PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:282)
#22     _dispatchPointerDataPacket (dart:ui/hooks.dart:96)
@jmshrv
Copy link
Owner

jmshrv commented Oct 4, 2021

That looks like the error that shows when checking for more on an error that happened in an alert dialog. Do you have any other errors?

@VileoSufora
Copy link
Author

VileoSufora commented Oct 4, 2021

I do, but it's a weird one.

[Flutter/SEVERE] 2021-10-03 20:23:36.398397: HttpException: Invalid statusCode: 404, uri = https://[server address]/Items/6035db88fb45b059f7d961d75974d9fd/Images/Primary?format=webp&MaxWidth=196&MaxHeight=196

EDIT: Worth noting that the error I initially posted came out twice and this error came out like... 30-ish times in the log. I thought that might be connected to the number of songs in the album, but that album has less than 30 songs.

@jmshrv
Copy link
Owner

jmshrv commented Oct 4, 2021

That error is when an image fails to load because you don't have an album image for that item. Are you trying to download to a custom directory or regular internal storage?

@VileoSufora
Copy link
Author

VileoSufora commented Oct 4, 2021

A custom directory on my SD card.
Edit: Since you mentioned that, I tried downloading to internal storage and it worked. Are there extra steps I need to take for using an SD card?

@jmshrv
Copy link
Owner

jmshrv commented Oct 4, 2021

There's a weird bug to do with how Android handles storage permissions that causes custom directories to fail on some phones. For now, you could use the "App Directory" option when creating a custom download location. There will be an option there that leads to the SD card. The only downside of this is that it'll be in the Android folder on your SD card.

The downloader plugin I'm using recently released an update that may fix this issue, so hopefully it works in the next release.

@MagicRB
Copy link

MagicRB commented Jan 11, 2022

Still not working on android 12 LineageOS

@ilya-zlobintsev
Copy link

ilya-zlobintsev commented Jan 10, 2023

This helped me get downloads to SD card working on LineageOS 20 (android 13):

adb shell pm grant com.unicornsonlsd.finamp android.permission.READ_EXTERNAL_STORAGE
adb shell pm grant com.unicornsonlsd.finamp android.permission.WRITE_EXTERNAL_STORAGE

For some reason the app didn't request the permission by itself.

@kai11
Copy link

kai11 commented May 25, 2023

Fix above (adb permissions) helps. Samsung Galaxy A53 / Android 13.
Usage of app directory in Internal storage dont require any permissions - I was able to download there before adb commands. However, for app directory on sdcard they are necessary af least on some phones.

@jmshrv
Copy link
Owner

jmshrv commented May 25, 2023

What's weird is that Finamp already uses those permissions

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

And we request that permission:

if (!await Permission.storage.request().isGranted) {

@kai11
Copy link

kai11 commented May 25, 2023

Permission handler dont even request WRITE for android > Q (10):

https://github.com/Baseflow/flutter-permission-handler/blob/master/permission_handler_android/android/src/main/java/com/baseflow/permissionhandler/PermissionUtils.java#LL204C14-L204C14

Issue with some sketchy workarounds: Baseflow/flutter-permission-handler#995
Maybe use Permission.manageExternalStorage.request instead?

@DX37
Copy link

DX37 commented Aug 13, 2023

Still present in recent versions. Fix in #134 (comment) working.

@Chaphasilor Chaphasilor changed the title Can't download songs Can't download songs into external storage Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

6 participants