osmin icon indicating copy to clipboard operation
osmin copied to clipboard

Bug or Enhancement: I want to decide, where maps and other stuff is stored

Open RealVegOs opened this issue 9 months ago • 9 comments

When I install the app on Android and select a map for my country, osmin just wants to download 4.4 GB to my internal storage, which is quite limited. I have an additional micro sd cart with 500 GB! So please let the user decide, where to store stuff. Thanks for any consideration.

RealVegOs avatar Mar 16 '25 14:03 RealVegOs

It was like that before Android 10. The culprit is Google, not me. So, starting with Android 10, the app cannot access the map database outside of its private storage, due to technical limitations imposed by the operating system. The other way is to use an other OS than Android as the PinePhone or any other postmarket running Linux.

janbar avatar Mar 16 '25 21:03 janbar

Even if Google changed something, AAT and Organic Maps offer this option.

RealVegOs avatar Mar 17 '25 14:03 RealVegOs

Edit: Could you please ask other devs who solved that problem? AAT too had writing problems for nearly a year. I used the previous version. Alas my tablet is not supported by Android alternatives. I checked often. I would like to run your app beside AAT for testing and recommending to others. AAT is very special and has no routing, which I do not need.

RealVegOs avatar Mar 23 '25 18:03 RealVegOs

Those apps don't use "database" (meaning files opened or memory mapped), but they use small files set read into memory.

You could see this issue https://github.com/osmandapp/OsmAnd/issues/16059. And definitively unsolvable by an app that is not allowed explicitly by google.

janbar avatar Mar 24 '25 17:03 janbar

For AATT see https://github.com/bailuk/AAT/blob/master/aat-android/src/main/AndroidManifest.xml also usage of MANAGE_EXTERNAL_STORAGE

Question to @janbar : Is this a "will not be accepted in play store" or is this a "will not work on modern devices" problem? Could two build version be a possible solution?

Framstag avatar Mar 24 '25 19:03 Framstag

Hi @Framstag ,

  • I guess it will not accepted in play store. But don't worry, the app is not in the Play Store.

  • And in my opinion it will not work on modern devices. Because Android team wants all apps use the storage access framework or mediastore api, to access the external storage (Those features are based on Java APIs). Probably for 2 reasons: First is security issues, and second is the external storage can be plugged/unplugged online on new devices. This last point is critical for the stability of the software: no app can keep file handle on the external storage.

janbar avatar Mar 24 '25 21:03 janbar

I'm not sure if this helps because I'm no Android expert. I had a problem with LocalSend. After last update, it could not write to it's default folder on my SD card. In the past, there was a setting where to locate the default folder - on built in or external storage. Now there was a dialog which showed Downloads/LocalSend as the path. I clicked on it and similar to the PC version I was able to create a LocalSend folder in the root of my SD card. Now LocalSend has write access again. On Linux I have all rights for a folder or file created by me - or does Android now mess with those rights?

RealVegOs avatar Mar 26 '25 12:03 RealVegOs

@RealVegOs , from Android 11 the external storage (SD card) became a real external storage, and no longer an extension of the internal storage. This storage was open and many spyware could read the content and steal your data, like photos, key files etc. So from Android 11, this storage is no longer readable by any apps. Now an app has to be granted to access it, and it should use a new API to GET/PUT files. On new request GET/PUT the OS (Android) open a notification to ask you to allow the access. So you can grant it, but it is your responsability and with your approval. Also the external storage can be unplug/plug online, that was not the case before. New devices allow to eject the card when the phone is running. Before you have to shutdown the device.

Until now Google enabled a special permission MANAGE_EXTERNAL_STORAGE for particular app, i.e the File Manager. This permission is restricted to few app trusted by the play store, and allows to read/write to external storage without your approval. Forcing this permission is a HACK and not approved.

janbar avatar Mar 26 '25 15:03 janbar

So it would work, if for a new database the user would explicitly select a directory, allow the app to access it after explicit request for allowance and then we could use this new directory for download?

However we would not have direct access to the files with standard C++ APIs (which would likely require major changes/additions to libosmscout (making FileScanner an interface with multiple implementations) with in result perhaps even means reduced performance?

Alternatively it could be used to have just one database in internal storage and all other in external by copying to local on select - which would disable libosmscout option to use multiple database for rendering and routing.

The application would however initially work with the default?

Framstag avatar Mar 26 '25 17:03 Framstag