Android - How to use GPS without using Google Location Services
Not exactly matching your description (using the "last known" position if not GPS available), but still a good alternative:
On two of my devices, I completely got rid of all proprietary Google services, replacing them by alternatives. In detail, I've described this in Android without Google 5: Free your Droid!¹ (update¹). In short, this is what I've done:
- Flash a custom ROM that comes without GApps (here: CyanogenMod)
- Installing microG (successor of NOGAPPS)
- Generating the
lacells.dbas described at XDA, and pushed it to the device
As a result, I've got a totally offline working location service using cell tower IDs and the
lacells.db, Playstore access via BlankStore¹ or YalpStore, and a working Maps API using OpenStreetMap. So with "no GPS active", I still get my location as long as there are cell towers in reach. I can, however, not say whether it's using the "last known position" if there's no GPS and no cell towers.
¹ Disclosure: link go to one of my sites
You could try this app: GPS Aids.
It tries to provide a quicker and more stable fix by providing a couple of GPS aids (GPS Aiding Data like LTO Long Term Orbits, gpsOneXTRA and AGPS), and it caches your last known GPS data.
It will run without root, but some options require root access.
Using Fairphone 2 and Fairphone Open OS and following this guide to living without Google, I set up location services using location middleware provider µg UnifiedNlp (no GAPPS)
It is easy to do this using the F-Droid repository
- Install µg UnifiedNlp (no GAPPS)
- Install geolocation backends such as LocalGsmNlpBackend
- Install geocoding backend NominatimeNlp
- Reboot your phone
- Start the µg UnifiedNlp app and set up the backends. In LocalGsmNlpBackend select 'create database' and let it generate a database from OpenCellID or Mozilla Location Services (this takes ages and downloads huge amounts of data so make sure you are on WiFi)
- Enable Location options in Settings
Result: both GPS and network-based location services work with little or no privacy impact.