jellyfin / jellyfin-android

Android Client for Jellyfin
https://jellyfin.org
GNU General Public License v2.0
1.53k stars 247 forks source link

Downloads broken on Android versions below 10 #72

Closed TKFRvisionOfficial closed 4 years ago

TKFRvisionOfficial commented 4 years ago

If I try to download a movie it dosent work. Sometimes the app crashes, sometimes nothing happens at all. The app also never requested file write and read premissions...

Nothing Happens

  1. Select movie by tap and holding it
  2. Click Download

The App crashes

  1. Select Show
  2. Select season
  3. On the Episode you want to download click three point menu
  4. tap download
  5. click wlan

System:

nielsvanvelzen commented 4 years ago

I tested this on a Oneplus 6 device running Android 10 using app version 2.0.0-rc.3 and it works for me. Can you provide us logs so we can have a better understanding of what goes wrong?

TKFRvisionOfficial commented 4 years ago

sorry i am a bit lost here...how do you get the logs?

Maxr1998 commented 4 years ago

sorry i am a bit lost here...how do you get the logs?

You need to dump the logs with a PC via adb and the logcat tool, there's a guide here: https://wiki.lineageos.org/logcat.html

TKFRvisionOfficial commented 4 years ago

yeah as i already told ya...the problem is that jellyfin never asked for write permission

09-04 14:53:15.380 11483 11483 E AndroidRuntime: Process: org.jellyfin.mobile, PID: 11483
09-04 14:53:15.380 11483 11483 E AndroidRuntime: java.lang.SecurityException: No permission to write to /storage/emulated/0/Download/Episode 101 -  Juliet Prowse.mkv: Neither user 10309 nor current process has android.permission.WRITE_EXTERNAL_STORAGE.
09-04 14:53:15.380 11483 11483 E AndroidRuntime:    at android.os.Parcel.createException(Parcel.java:1950)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:    at android.os.Parcel.readException(Parcel.java:1918)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:    at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:    at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:    at android.content.ContentProviderProxy.insert(ContentProviderNative.java:476)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:    at android.content.ContentResolver.insert(ContentResolver.java:1590)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:    at android.app.DownloadManager.enqueue(DownloadManager.java:1022)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:    at org.jellyfin.mobile.utils.SystemUtilsKt.downloadFile(SystemUtils.kt:82)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:    at org.jellyfin.mobile.utils.SystemUtilsKt.access$downloadFile(SystemUtils.kt:1)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:    at org.jellyfin.mobile.utils.SystemUtilsKt$requestDownload$1$1.onClick(SystemUtils.kt:59)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:    at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:172)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:106)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:193)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:6692)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
nielsvanvelzen commented 4 years ago

Thank you for providing the logs @TKFRvisionOfficial. I think I have identified the issue because of them.

I created a pull request that might fix it (#91)

TKFRvisionOfficial commented 4 years ago

Issue persisit: use azure pipeline version: https://dev.azure.com/jellyfin-project/jellyfin/_build/results?buildId=13809&view=artifacts&type=publishedArtifacts

nielsvanvelzen commented 4 years ago

@TKFRvisionOfficial can you test it again? I implemented a proper fix now.

TKFRvisionOfficial commented 4 years ago

do not close without testing...it is still not working...we are back to square one...

The App dosent crash anymore BUT when I tap the download button nothing happens: log reads 09-05 13:24:32.383 9052 11976 W DownloadManager: Path appears to be invalid: /storage/emulated/0/Download/Muppet Show Special - Sex and Violence.mkv

Maxr1998 commented 4 years ago

do not close without testing...it is still not working...we are back to square one...

Well, we tested this though, it works both on Android 9 and 10 in my testing.

The App dosent crash anymore BUT when I tap the download button nothing happens: log reads 09-05 13:24:32.383 9052 11976 W DownloadManager: Path appears to be invalid: /storage/emulated/0/Download/Muppet Show Special - Sex and Violence.mkv

This looks like an issue with your device configuration or ROM though - we just pass the request to the download manager, and if that fails, there's - to my knowledge - nothing we can do, except maybe add some ugly workarounds for some OEMs. You did grant the storage permission?

TKFRvisionOfficial commented 4 years ago

Well after searching a bit I even found that:

09-05 13:29:46.156  9052 14794 W DownloadManager: [4121] Stop requested with status FILE_ERROR
09-05 13:29:46.156  9052 14794 D DownloadManager: [4121] Finished with status FILE_ERROR

Also it shouldnt be my phone because I have Android One!? Its suprises me that there are differences between devices when it comes to this shit...

PS: Thank you for helping. It is awesome that you react so fast...wirklich danke

Maxr1998 commented 4 years ago

Could you check whether the folder Download exists in your internal storage, e.g. with a file explorer or the built-in files app? Could you try to manually create it? I'd assume that the system would create the system downloads folder, but maybe it doesn't.

TKFRvisionOfficial commented 4 years ago

Yes it exists jasmine_sprout:/storage/emulated/0/Download

bosche83 commented 2 years ago

yeah as i already told ya...the problem is that jellyfin never asked for write permission

09-04 14:53:15.380 11483 11483 E AndroidRuntime: Process: org.jellyfin.mobile, PID: 11483
09-04 14:53:15.380 11483 11483 E AndroidRuntime: java.lang.SecurityException: No permission to write to /storage/emulated/0/Download/Episode 101 -  Juliet Prowse.mkv: Neither user 10309 nor current process has android.permission.WRITE_EXTERNAL_STORAGE.
09-04 14:53:15.380 11483 11483 E AndroidRuntime:  at android.os.Parcel.createException(Parcel.java:1950)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:  at android.os.Parcel.readException(Parcel.java:1918)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:  at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:  at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:  at android.content.ContentProviderProxy.insert(ContentProviderNative.java:476)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:  at android.content.ContentResolver.insert(ContentResolver.java:1590)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:  at android.app.DownloadManager.enqueue(DownloadManager.java:1022)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:  at org.jellyfin.mobile.utils.SystemUtilsKt.downloadFile(SystemUtils.kt:82)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:  at org.jellyfin.mobile.utils.SystemUtilsKt.access$downloadFile(SystemUtils.kt:1)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:  at org.jellyfin.mobile.utils.SystemUtilsKt$requestDownload$1$1.onClick(SystemUtils.kt:59)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:  at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:172)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:  at android.os.Handler.dispatchMessage(Handler.java:106)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:  at android.os.Looper.loop(Looper.java:193)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:  at android.app.ActivityThread.main(ActivityThread.java:6692)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:  at java.lang.reflect.Method.invoke(Native Method)
09-04 14:53:15.380 11483 11483 E AndroidRuntime:  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)