xyzz / openmw-android

OpenMW for Android
https://omw.xyz.is/
GNU General Public License v3.0
325 stars 87 forks source link

Build 28 - unable to select game folder #30

Closed licaon-kter closed 4 years ago

licaon-kter commented 4 years ago

Try to setup the game folder, seeing the pop-up with internal storage, touch it, see toast: The storage you have chosen is not accessible

No issues on 27, Xiaomi MIUI11 Android 10

My guess is https://github.com/xyzz/openmw-android/commit/0b148ef8a37609877ef54d3fd708cdf17335b429 and some new restrictions: https://stackoverflow.com/questions/57963282/mediascanner-and-scopedstorage-on-sdk-29

xyzz commented 4 years ago

Yes you're right, resolved with 341806ef9561ffcc686c1e8d9e8c05c176579b14 for now.

licaon-kter commented 4 years ago

Adding android:requestLegacyExternalStorage="true" to the manifest works too.

Now, for F-Droid we could just downgrade the SDK as needed before build, since we are not restricted, but for Play you'd need to fix this better next year.

xyzz commented 4 years ago

As of now there is no way to fix this properly because NDK does not have support for SAF. There are currently two ways that this could be worked around:

I kind of expect google to roll back the whole SAF idea but if they don't, we'll have to see what other bigger NDK apps decide to do (e.g. VLC).

AJenbo commented 3 years ago

I came across this when figuring out how to handle this issue in https://github.com/diasurgical/devilutionX since we are working on adding Android support.

The solution I have found is to use the app-specific directory on external storage instead (/storage/<medium>/Android/data/is.xyz.omw/files), no permissions required and it doesn't take 2x. This will be accessible from the PC as: mtp://<device>/<medium>/Android/data/is.xyz.omw/files

You can have a path like this on each attached storage device (internal, external, SD-card, etc.).

If you query the location path from Kotlin/Java it will create the folders on the device: https://developer.android.com/training/data-storage/app-specific#external I believe this could also be used as a way for the user to pick what storage device they would prefer the files to be located on, similar to what you do now but on a disk level instead of folder level.

This should be compatible with Android 4.4 and up.

From what I can gather there won't be support for SAF in NDK, only media file access via path and it will use a slow wrapper.

I'm not sure why this issue is closed since you are still on API 29 and reference the issue as a blocker int the code. By November Google will only accept updates to apps if they use API 30.

The best thing to do is to push an update that supports this but still only requires API level 29, on next boot move over all the files while you still have access to the general storage (old location). In a future update (past November 2021 you can then bump to API 30 and drop the media access, people that installed the intermediate update will continue to have the app working with no interruptions.

P.s. feel free to copy from our solution once i get it done in a couple of days.

xyzz commented 3 years ago

Well it's closed because it was opened in 2019 and we had no idea how google would proceed with SAF or google play requirements - feel free to open a new issue about it; that said given this & other recent issues (samsung touch controls #63), lack of time and motivation on my part I'll likely just discontinue this project come November.

licaon-kter commented 3 years ago

@xyzz is the OpenMW project gonna pick up this then? :(

AJenbo commented 3 years ago

In case you are interested here is how we solved this for DevilutionX:

https://github.com/diasurgical/devilutionX/commit/9818ad48914f5cfea894572ff3b53c1371ade6f4

This includes migrating the existing data from the old location to the app external folder. Again note that any such update must be pushed to Google Play before November or the user will have to do the migration manually.