openbmap / radiocells-nlp-android

radiocells.org Unified Network Location Provider
https://radiocells.org
Other
41 stars 13 forks source link

File access restrictions in Android 10/11 #52

Open mvglasow opened 3 years ago

mvglasow commented 3 years ago

Android 10 introduced new restrictions on file access by apps (with an opt-out for existing apps, which was discontinued in 11). These are designed to prevent apps from accessing each other’s files, and reduce filesystem access to shared storage.

This becomes an issue when sharing a cell/wifi database between Radiobeacon and the location provider backend (as I do, so whenever I scan new wifis, I can immediately use them for georeferencing).

Rules for file access are as follows:

On the other hand, sharing an SQLite database file between two processes has never been a good idea (afaik simultaneous access isn’t even supported), so this would be the time to sort this out. The Android way would be to use a content provider. If the backend is a SQLite database, this is fairly straightforward. The architecture then would be:

Those who use Radiobeacon and the location provider backend would then have the location provider backend manage the DB, and Radiobeacon would rely on the location provider backend for any DB operations. Those who use just one or the other could continue to do so, with no changes.