This object is in archive! 

Android 30, access to file-system

Bill Chadwick shared this question 3 years ago
Answered

Hi,

Are you able to share with me how Locus built for API30 will be able to load offline maps such as mbtiles and gems? 

Are you going to request the manage storage permission, or have you found some way to load an mbtiles file or gemf file from shared storage?

I believe that both mbtiles and gems need access through the File API to be loadable.

Thanks,

Bill

On Mon, 10 Jun 2019, 14:44 Locus Map, <locus.map@asamm.com> wrote:

Replies (5)

photo
1

Hello Bill,

firstly, I've changed your question to public topic, because I'm sure, it will be interesting for a lot of users.

Seems you are well informed about coming changes.

Unfortunately, you are correct. SQLite databases require direct java.io.File access that is no longer possible on modern Android devices.

Since November, we are no longer able to publish an application version that will have access to the filesystem as before. So the next Locus Map version will require the full transfer of the whole app directory to its private storage for all Android version 11+. I'll be then working on some options how to for example import any data from the "Download" directory etc.

Custom maps will be still possible in the case, you copy them to the app private directory. As I test it, it is possible with updated file browsers like with "Solid explorer" and probably many others.

Feel free to ask if there will be any additional questions.

Jiří M. aka Menion

photo
1

Hi Menion,

I think we might be able to do something with the gemf archive format on Android 30. I have successfully got a file input stream from a URI to a gemf and read its header. The traditional Android gemf reader code used a random access file, but I think a simple file input stream will suffice, though may not perform quite as well.

Bill

photo
1

Hi,

yes, this should be doable, but question is if it worth the time. I was converting existing system for reading elevation values from direct `RandomAccessFill` to the `FileChannel` obtained from ScopedStorage reference and the result > more then 2x worst performance. Which is terrible for map shading and is it also a terrible for the reading of any map tiles ...

So my two cents for now: it does not worth it.

Menion

photo
1

Have you considered applying for manage files permission for Locus? Given that Google's API changes have essentially prohibited sharing map archives between apps which is a reasonable thing to want to do, especially with large archives. 

Bill

photo
1

Sure, we discussed this internally, but Locus Map is far away from minimal requirements. The app does not behave like a file browser app and a simple "pick GPX" task may be done even with the available system.

As I look to the implementation of GEMF format in the app, I may confirm what you wrote > it seems to be doable with the Scoped storage system. For me, it anyway not worth it to be true. Core app format is based on SQLite database where java.io.File is crucial and to have only a partially working system, I would rather stick with new "no for all". Thanks for understanding.

Jiří M. aka Menion

photo
1

So future versions of Locus will have to make a copy of offline maps into local storage. These may easily be many Gb in size and take a long time to copy. A  GEMF may comprise several files. If a user has more than one offline Map App installed, each will have to do the copy.

I still don't quite understand why Google have it so that if the user grants access permission to a folder, why File I/O can't be used for non-media files.

Bill 

photo
1

This is correct, every app will have to use own copy. But this is something I do not consider as a problem. My expectation is that every user use mainly one favorite app.

And why Google did it? Security reasons in most cases + trash that every app left in the device when un-installed.

I spend on this maybe 2 months of various testing, but I fully understand this change to be true ...

Replies have been locked on this page!