Beaver-pocket icon indicating copy to clipboard operation
Beaver-pocket copied to clipboard

Can't create file in Android 10+

Open bigshans opened this issue 1 year ago • 8 comments

Describe the bug Pocket can't create files on Android 10.

Screenshots 图片

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: Android 13, Android 14

Additional context

  1. https://stackoverflow.com/a/68749082
  2. https://github.com/ionic-team/capacitor/issues/2916

bigshans avatar Mar 11 '24 13:03 bigshans

Thanks for pointing this out. I've looked into the issue and the additional context you provided, and I've updated the AndroidManifest.xml accordingly. The only issue we have is the following: The Google Play store has a policy that limits the usage of MANAGE_EXTERNAL_STORAGE, but we'll deal with Google later if need be.

Daniele-rolli avatar Mar 11 '24 13:03 Daniele-rolli

Still has some problems for Android. I have ensured I built the debug application correctly but the application didn't request permission when it started.

bigshans avatar Mar 11 '24 14:03 bigshans

So, let me get this straight: it does work now, but it doesn't ask for permission before accessing the device's filesystem, right?

Daniele-rolli avatar Mar 11 '24 15:03 Daniele-rolli

So, let me get this straight: it does work now, but it doesn't ask for permission before accessing the device's filesystem, right

No, it doesn't work properly. I still get errors when the application tries to write files. And it doesn't request permission either. In settings, it says no permissions are required.

bigshans avatar Mar 11 '24 15:03 bigshans

Uhm, I'll look into it, however it does work on android studio somehow.

Daniele-rolli avatar Mar 11 '24 15:03 Daniele-rolli

Uhm, I'll look into it, however it does work on android studio somehow.

What's your Android version?

bigshans avatar Mar 11 '24 15:03 bigshans

Here's the emulator's about section, as you can see it's running android 13 so it should be part of this issue. Anyway I believe I've found something in capacitor's documentation concerning permissions.

Screenshot_20240311_163325

Daniele-rolli avatar Mar 11 '24 15:03 Daniele-rolli

I've browsed a bit and maybe the only quick fix is changing the way we store files. Since the app doesn't have access to the Documents folder anymore, we can change it to save the data under Data.

Daniele-rolli avatar Mar 11 '24 15:03 Daniele-rolli