n76 / Local-GSM-Backend

GSM LocationProvider backend for µg UnifiedNlp
Apache License 2.0
91 stars 23 forks source link

Downloading scripts on the phone doesn't work #8

Closed Susurrus closed 9 years ago

Susurrus commented 9 years ago

I've gotten it to download and process the Mozilla and OpenCellID databases, so that the button at the bottom says "Done". But then when I click that and it goes back to the settings screen it says that there's no database found. This is using MCC "310,311" which are the default and happens when doing just the Mozilla database and when doing both. The README mentions no other instructions so I assume the error isn't on my end.

n76 commented 9 years ago

If you exit the settings menu and then re-enter it, does it show a database date?

I think that is an artifact of how I handle synchronization between the download thread and the location lookup thread: The download thread puts the database file with a ".new" suffix into the /sdcard/.nogapps directory. When the lookup thread next has anything to do it checks and if there is a new database it closes the old database (if any) and then renames the current to ".old" and then ".new" to the current.

However all that happens after you return to the settings pane after the download is complete so at that time there is either no database (first time) or an old database (later downloads) which is shown.

Susurrus commented 9 years ago

No it doesn't. I've downloaded multiple times to where it's said finished and the buttons says Done.

But your comment about the files had me look into the filesystem. Which I neglected to take a screenshot of, but it had three files, a .db, a .new, and a .old file.

So now I've deleted them and an downloading a new Mozilla location Services file (can't do OpenCellID again today). It downloaded successfully, told me it was finished, and I hit okay. It still didn't show a database even when existing the settings and going back in. And looking at the .nogapps folder I don't see any files.

n76 commented 9 years ago

First, thank you for your patience! Waiting for downloads to complete can be very frustrating.

Question: Was there any text above the "Finished" that mentioned indexing?

I just had a failure that I think might be like you describe and on that one the "indexing" text was missing and no new database was created. Unfortunately, with the release build there is insufficient logging to show what went wrong. At the least, I need to expand on the logging to the screen to show if the "finished" was successful or not and if not why. Here is the screen shot of the failed load:

screenshot_2015-02-11-14-43-19

Here is one that worked (I had to only do Mozilla):

screenshot_2015-02-11-14-57-13

If you watch the /sdcard/.nogapps directory you can see how the database file management works:

shell@maguro:/sdcard/.nogapps $ ls -l
drwxrwx--- root sdcard_r 2015-01-27 10:39 blankstore -rw-rw---- root sdcard_r 111808512 2015-01-23 19:32 lacells.db -rw-rw---- root sdcard_r 107044864 2015-01-13 16:26 lacells.db.bak -rw-rw---- root sdcard_r 38100992 2015-02-11 14:56 new_lacells-1387648386.db -rw-rw---- root sdcard_r 37448 2015-02-11 14:56 new_lacells-1387648386.db-journal shell@maguro:/sdcard/.nogapps $ ls -l
drwxrwx--- root sdcard_r 2015-01-27 10:39 blankstore -rw-rw---- root sdcard_r 111808512 2015-01-23 19:32 lacells.db -rw-rw---- root sdcard_r 107044864 2015-01-13 16:26 lacells.db.bak -rw-rw---- root sdcard_r 48066560 2015-02-11 14:56 lacells.db.new shell@maguro:/sdcard/.nogapps $ ls -l
drwxrwx--- root sdcard_r 2015-01-27 10:39 blankstore -rw-rw---- root sdcard_r 48066560 2015-02-11 14:56 lacells.db -rw-rw---- root sdcard_r 111808512 2015-01-23 19:32 lacells.db.bak shell@maguro:/sdcard/.nogapps $

Susurrus commented 9 years ago

I have had downloads fail to index before, but the most recent one I last posted about did finish indexing.

Would it be worth you adding a logging feature that just saves a more detailed text log into the .nogapps directory of what's happening. This then won't clutter the UI but can still be used for debugging. And if it only ever saves the last download, it won't take up too much space.

n76 commented 9 years ago

Good idea on writing a text log to .nogapps. I'll definitely do that.

Susurrus commented 9 years ago

And I don't see any data in .nogapps anymore, even when the database download completes successfully. Would deleting the old .db file have broken this thing?

n76 commented 9 years ago

Deleting the old .db should have no effect. In the last hour I both checked the code and tried it and downloads work with no old .db file as well as with an old .db file.

But I've been beating on the download and I've had another failure, looks like the download loop exited because of an external state change request but, again, I didn't have enough logging to verify. Adding more logging for error conditions. Since it does not fail for me very often, it may take a while to chase this down.

Susurrus commented 9 years ago

No worries, I'm happy to help test also. I can't build .apks, but if you can post one, I'll run it for you.

n76 commented 9 years ago

I've just pushed a new version that adds a log file and some additional logging. If you are willing to wait, it seems F-Droid is fairly rapid at making builds. If you are not willing to wait, I put my latest on Dropbox at https://dl.dropboxusercontent.com/u/19663978/android_apps_gsmlp-debug.apk

Susurrus commented 9 years ago

Downloaded it and ran it, but I still see nothing in the .nogapps directory at all. It also failed to change the Cancel button into an Okay button after it says Finished, so this would've been nice to have seen a log for. Don't really know what to do at this point. :-/

n76 commented 9 years ago

Not even a lacells_gen.log file in .nogapps directory?

Is it possible to send a personal message on GitHub? I haven't seen a way but I'd like to send you my email address. It would make it easier to share files and notes to get to the bottom of this issue.

Susurrus commented 9 years ago

just email me, susurrus at gmail

Susurrus commented 9 years ago

and nothing in that directory

Susurrus commented 9 years ago

Looks like I lied. There is a log and db.new file in the directory.

Susurrus commented 9 years ago

Log doesnt say anything besides what I normally see on the screen. No extra errors or anything.

Susurrus commented 9 years ago

I'll try the Mozilla db again.

n76 commented 9 years ago

Try leaving the settings, verify that the backend is checked in the UnifiedNLP settings and then do something that needs a location. After that look in .nogapps and see if the .new file has been renamed to lacells.db

n76 commented 9 years ago

Also, if you can do a logcat, you should see some entries with the string "backend" in them including some from UnifiedNLP which will say which backend(s) it has gotten data from and what it got.

Susurrus commented 9 years ago

Never got the settings app to rename the db file, but doing it manually now has it showing up.

Havent see the backend popup yet. I'll post a log.

Susurrus commented 9 years ago
I/ActivityManager(  551): Start proc org.microg.nlp.backend.nominatim for service org.microg.nlp.backend.nominatim/.BackendService: pid=1171 uid=10107 gids={50107, 9997, 3003, 1028, 1015} abi=armeabi-v7a
I/ActivityManager(  551): Start proc org.fitchfamily.android.wifi_backend for service org.fitchfamily.android.wifi_backend/.BackendService: pid=1417 uid=10079 gids={50079, 9997} abi=armeabi-v7a
W/ActivityManager(  551): Unable to start service Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.gsmlocation cmp=org.fitchfamily.android.gsmlocation/.GSMService } U=0: not found
I/ActivityManager(  551): START u0 {act=android.intent.action.VIEW dat=https://github.com/n76/Local-GSM-Backend/issues/8 flg=0x90000 cmp=org.mozilla.firefox/.App (has extras)} from uid 10020 on display 0
D/NlpGeocodeBackendHelper(  950): Unbinding from: Intent { act=org.microg.nlp.GEOCODER_BACKEND pkg=org.microg.nlp.backend.nominatim cmp=org.microg.nlp.backend.nominatim/.BackendService }
D/NlpLocationBackendHelper(  950): Unbinding from: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.wifi_backend cmp=org.fitchfamily.android.wifi_backend/.BackendService }
D/NlpGeocodeBackendHelper(  950): Binding to: Intent { act=org.microg.nlp.GEOCODER_BACKEND pkg=org.microg.nlp.backend.nominatim cmp=org.microg.nlp.backend.nominatim/.BackendService }
D/NlpLocationBackendHelper(  950): Unbinding from: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.gsmlocation cmp=org.fitchfamily.android.gsmlocation/.GSMService }
D/NlpGeocodeBackendHelper(  950): Bound to: ComponentInfo{org.microg.nlp.backend.nominatim/org.microg.nlp.backend.nominatim.BackendService}
D/gsm-backend-service( 9673): Binder CLOSE called
D/NlpLocationBackendHelper(  950): Binding to: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.wifi_backend cmp=org.fitchfamily.android.wifi_backend/.BackendService }
D/NlpLocationBackendHelper(  950): Binding to: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.gsmlocation cmp=org.fitchfamily.android.gsmlocation/.GSMService }
D/NlpLocationBackendHelper(  950): Not (yet) bound.
D/NlpLocationBackendHelper(  950): Not (yet) bound.
D/NlpLocationBackendHelper(  950): Bound to: ComponentInfo{org.fitchfamily.android.wifi_backend/org.fitchfamily.android.wifi_backend.BackendService}
D/wifi-backend-configuation( 1417): fillFromPrefs(): Min GPS accuracy: 10.0
D/wifi-backend-configuation( 1417): fillFromPrefs(): Min GPS time: 5000
D/wifi-backend-configuation( 1417): fillFromPrefs(): Min GPS distance: 0.0
D/wifi-backend-configuation( 1417): fillFromPrefs(): AP min range: 50.0
D/wifi-backend-configuation( 1417): fillFromPrefs(): AP moved threshold: 1250.0
D/wifi-backend-configuation( 1417): fillFromPrefs(): AP moved guard count: 50
D/NlpLocationBackendHelper(  950): Bound to: ComponentInfo{org.fitchfamily.android.gsmlocation/org.fitchfamily.android.gsmlocation.GSMService}
D/gsm-backend-service( 9673): Starting location backend
D/gsm-backend-service( 9673): Binder OPEN called
D/gsm-backend-service( 9673): Starting reporter thread
D/NlpLocationBackendHelper(  950): Unbinding from: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.wifi_backend cmp=org.fitchfamily.android.wifi_backend/.BackendService }
D/NlpGeocodeBackendHelper(  950): Unbinding from: Intent { act=org.microg.nlp.GEOCODER_BACKEND pkg=org.microg.nlp.backend.nominatim cmp=org.microg.nlp.backend.nominatim/.BackendService }
D/NlpGeocodeBackendHelper(  950): Binding to: Intent { act=org.microg.nlp.GEOCODER_BACKEND pkg=org.microg.nlp.backend.nominatim cmp=org.microg.nlp.backend.nominatim/.BackendService }
D/NlpLocationBackendHelper(  950): Unbinding from: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.gsmlocation cmp=org.fitchfamily.android.gsmlocation/.GSMService }
D/NlpGeocodeBackendHelper(  950): Bound to: ComponentInfo{org.microg.nlp.backend.nominatim/org.microg.nlp.backend.nominatim.BackendService}
D/gsm-backend-service( 9673): Binder CLOSE called
D/NlpLocationBackendHelper(  950): Binding to: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.wifi_backend cmp=org.fitchfamily.android.wifi_backend/.BackendService }
D/NlpLocationBackendHelper(  950): Binding to: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.gsmlocation cmp=org.fitchfamily.android.gsmlocation/.GSMService }
D/NlpLocationBackendHelper(  950): Bound to: ComponentInfo{org.fitchfamily.android.wifi_backend/org.fitchfamily.android.wifi_backend.BackendService}
D/wifi-backend-configuation( 1417): fillFromPrefs(): Min GPS accuracy: 10.0
D/wifi-backend-configuation( 1417): fillFromPrefs(): Min GPS time: 5000
D/wifi-backend-configuation( 1417): fillFromPrefs(): Min GPS distance: 0.0
D/wifi-backend-configuation( 1417): fillFromPrefs(): AP min range: 50.0
D/wifi-backend-configuation( 1417): fillFromPrefs(): AP moved threshold: 1250.0
D/wifi-backend-configuation( 1417): fillFromPrefs(): AP moved guard count: 50
D/NlpLocationBackendHelper(  950): Not (yet) bound.
D/NlpLocationBackendHelper(  950): Bound to: ComponentInfo{org.fitchfamily.android.gsmlocation/org.fitchfamily.android.gsmlocation.GSMService}
D/gsm-backend-service( 9673): Starting location backend
D/gsm-backend-service( 9673): Binder OPEN called
D/gsm-backend-service( 9673): Starting reporter thread
D/gsm-backend-settings( 9673): prefsFragment.onCreate(): ociKeyPreference is OpenCellId API
D/gsm-backend-settings( 9673): prefsFragment.onCreate(): mccFilterPreference is MCC Filter
D/gsm-backend-settings( 9673): Use OpenCellID data = false
D/gsm-backend-settings( 9673): Use Mozilla data = true
D/gsm-backend-settings( 9673): OpenCellId API Key = 
D/gsm-backend-settings( 9673): MCC filtering = 310,311
D/gsm-backend-settings( 9673): Inputs validated: Start background processing...
D/gsm-backend-settings( 9673): Use OpenCellID data = false
D/gsm-backend-settings( 9673): Use Mozilla data = true
D/gsm-backend-settings( 9673): OpenCellId API Key = 
D/gsm-backend-settings( 9673): MCC filtering = 310,311
I/gsm-backend-dlActivity( 9673): onCreate(Bundle)
D/gsm-backend-dlActivity( 9673): Use OpenCellID data = false
D/gsm-backend-dlActivity( 9673): Use Mozilla data = true
D/gsm-backend-dlActivity( 9673): OpenCellId API Key = 
D/gsm-backend-dlActivity( 9673): MCC filtering = 310,311
D/gsm-backend-dlFragment( 9673): downloadDataAsync.setState(0)
D/gsm-backend-dlFragment( 9673): downloadDataAsync:initialize(false, true, "", "310,311")
D/gsm-backend-dlFragment( 9673): downloadDataAsync: MCC filter: 310,311
I/gsm-backend-dlFragment( 9673): onAttach(Activity)
I/gsm-backend-dlFragment( 9673): onCreate(Bundle)
I/gsm-backend-dlFragment( 9673): onCreate(Bundle)
I/gsm-backend-dlActivity( 9673): onStart()
I/gsm-backend-dlFragment( 9673): onStart()
I/gsm-backend-dlActivity( 9673): onResume()
I/gsm-backend-dlFragment( 9673): onResume()
D/gsm-backend-dlFragment( 9673): downloadDataAsync: Getting Tower Data From Mozilla Location Services. . .
D/gsm-backend-dlFragment( 9673): downloadDataAsync: URL is https://d17pt8qph6ncyq.cloudfront.net/export/MLS-full-cell-export-2015-02-12T000000.csv.gz
D/gsm-backend-dlFragment( 9673): downloadDataAsync: Content length = 83350826
D/gsm-backend-dlFragment( 9673): downloadDataAsync: Records Read: 3601733, Inserted: 548657
D/gsm-backend-dlFragment( 9673): downloadDataAsync: Total Time: 381571ms (0.106ms/record)
D/gsm-backend-dlFragment( 9673): downloadDataAsync: Creating indicies for faster access.
D/gsm-backend-dlFragment( 9673): downloadDataAsync.setState(3)
D/gsm-backend-dlFragment( 9673): downloadDataAsync: Total Time: 398505ms
D/gsm-backend-dlFragment( 9673): downloadDataAsync: Finished.
I/gsm-backend-dlActivity( 9673): onPostExecute()
I/gsm-backend-dlActivity( 9673): mButton.onClick: Finish Activity
I/gsm-backend-dlFragment( 9673): onPause()
I/gsm-backend-dlActivity( 9673): onPause()
I/gsm-backend-dlFragment( 9673): onStop()
I/gsm-backend-dlActivity( 9673): onStop()
I/gsm-backend-dlFragment( 9673): onDestroy()
I/gsm-backend-dlFragment( 9673): cancel()
D/gsm-backend-dlFragment( 9673): downloadDataAsync.setState(1)
I/gsm-backend-dlActivity( 9673): onDestroy()
D/NlpLocationBackendHelper(  950): Unbinding from: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.wifi_backend cmp=org.fitchfamily.android.wifi_backend/.BackendService }
D/NlpLocationBackendHelper(  950): Unbinding from: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.gsmlocation cmp=org.fitchfamily.android.gsmlocation/.GSMService }
D/gsm-backend-service( 9673): Binder CLOSE called
D/NlpLocationBackendHelper(  950): Binding to: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.gsmlocation cmp=org.fitchfamily.android.gsmlocation/.GSMService }
D/NlpLocationBackendHelper(  950): Not (yet) bound.
D/NlpLocationBackendHelper(  950): Bound to: ComponentInfo{org.fitchfamily.android.gsmlocation/org.fitchfamily.android.gsmlocation.GSMService}
D/gsm-backend-service( 9673): Starting location backend
D/gsm-backend-service( 9673): Binder OPEN called
D/gsm-backend-service( 9673): Starting reporter thread
D/NlpLocationBackendHelper(  950): Unbinding from: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.gsmlocation cmp=org.fitchfamily.android.gsmlocation/.GSMService }
D/gsm-backend-service( 9673): Binder CLOSE called
D/NlpLocationBackendHelper(  950): Binding to: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.gsmlocation cmp=org.fitchfamily.android.gsmlocation/.GSMService }
D/NlpLocationBackendHelper(  950): Not (yet) bound.
D/NlpLocationBackendHelper(  950): Bound to: ComponentInfo{org.fitchfamily.android.gsmlocation/org.fitchfamily.android.gsmlocation.GSMService}
D/gsm-backend-service( 9673): Starting location backend
D/gsm-backend-service( 9673): Binder OPEN called
D/gsm-backend-service( 9673): Starting reporter thread
D/gsm-backend-settings( 9673): prefsFragment.onCreate(): ociKeyPreference is OpenCellId API
D/gsm-backend-settings( 9673): prefsFragment.onCreate(): mccFilterPreference is MCC Filter
I/Timeline(  950): Timeline: Activity_launch_request id:org.fitchfamily.android.wifi_backend time:13614659
I/ActivityManager(  551): START u0 {act=android.intent.action.VIEW pkg=org.fitchfamily.android.wifi_backend cmp=org.fitchfamily.android.wifi_backend/.settings} from uid 10156 on display 0
I/ActivityManager(  551): Displayed org.fitchfamily.android.wifi_backend/.settings: +495ms
I/Timeline(  551): Timeline: Activity_windows_visible id: ActivityRecord{37b78bf1 u0 org.fitchfamily.android.wifi_backend/.settings t120} time:13615569
D/NlpLocationBackendHelper(  950): Unbinding from: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.gsmlocation cmp=org.fitchfamily.android.gsmlocation/.GSMService }
D/gsm-backend-service( 9673): Binder CLOSE called
D/NlpLocationBackendHelper(  950): Binding to: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.wifi_backend cmp=org.fitchfamily.android.wifi_backend/.BackendService }
D/NlpLocationBackendHelper(  950): Binding to: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.gsmlocation cmp=org.fitchfamily.android.gsmlocation/.GSMService }
D/NlpLocationBackendHelper(  950): Bound to: ComponentInfo{org.fitchfamily.android.wifi_backend/org.fitchfamily.android.wifi_backend.BackendService}
D/wifi-backend-configuation( 1417): fillFromPrefs(): Min GPS accuracy: 10.0
D/wifi-backend-configuation( 1417): fillFromPrefs(): Min GPS time: 5000
D/wifi-backend-configuation( 1417): fillFromPrefs(): Min GPS distance: 0.0
D/wifi-backend-configuation( 1417): fillFromPrefs(): AP min range: 50.0
D/wifi-backend-configuation( 1417): fillFromPrefs(): AP moved threshold: 1250.0
D/wifi-backend-configuation( 1417): fillFromPrefs(): AP moved guard count: 50
D/NlpLocationBackendHelper(  950): Not (yet) bound.
D/NlpLocationBackendHelper(  950): Bound to: ComponentInfo{org.fitchfamily.android.gsmlocation/org.fitchfamily.android.gsmlocation.GSMService}
D/gsm-backend-service( 9673): Starting location backend
D/gsm-backend-service( 9673): Binder OPEN called
D/gsm-backend-service( 9673): Starting reporter thread
D/NlpLocationBackendHelper(  950): Unbinding from: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.wifi_backend cmp=org.fitchfamily.android.wifi_backend/.BackendService }
D/NlpGeocodeBackendHelper(  950): Unbinding from: Intent { act=org.microg.nlp.GEOCODER_BACKEND pkg=org.microg.nlp.backend.nominatim cmp=org.microg.nlp.backend.nominatim/.BackendService }
D/NlpGeocodeBackendHelper(  950): Binding to: Intent { act=org.microg.nlp.GEOCODER_BACKEND pkg=org.microg.nlp.backend.nominatim cmp=org.microg.nlp.backend.nominatim/.BackendService }
D/NlpLocationBackendHelper(  950): Unbinding from: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.gsmlocation cmp=org.fitchfamily.android.gsmlocation/.GSMService }
D/gsm-backend-service( 9673): Binder CLOSE called
D/NlpLocationBackendHelper(  950): Binding to: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.wifi_backend cmp=org.fitchfamily.android.wifi_backend/.BackendService }
D/NlpGeocodeBackendHelper(  950): Bound to: ComponentInfo{org.microg.nlp.backend.nominatim/org.microg.nlp.backend.nominatim.BackendService}
D/NlpLocationBackendHelper(  950): Binding to: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.gsmlocation cmp=org.fitchfamily.android.gsmlocation/.GSMService }
D/NlpLocationBackendHelper(  950): Bound to: ComponentInfo{org.fitchfamily.android.wifi_backend/org.fitchfamily.android.wifi_backend.BackendService}
D/wifi-backend-configuation( 1417): fillFromPrefs(): Min GPS accuracy: 10.0
D/wifi-backend-configuation( 1417): fillFromPrefs(): Min GPS time: 5000
D/wifi-backend-configuation( 1417): fillFromPrefs(): Min GPS distance: 0.0
D/wifi-backend-configuation( 1417): fillFromPrefs(): AP min range: 50.0
D/wifi-backend-configuation( 1417): fillFromPrefs(): AP moved threshold: 1250.0
D/wifi-backend-configuation( 1417): fillFromPrefs(): AP moved guard count: 50
D/NlpLocationBackendHelper(  950): Not (yet) bound.
D/NlpLocationBackendHelper(  950): Bound to: ComponentInfo{org.fitchfamily.android.gsmlocation/org.fitchfamily.android.gsmlocation.GSMService}
D/gsm-backend-service( 9673): Starting location backend
D/gsm-backend-service( 9673): Binder OPEN called
D/gsm-backend-service( 9673): Starting reporter thread
n76 commented 9 years ago

Interesting that I don't see a log message with "NlpLocationBackendFuser" in it. The GSM backend will do all of its housekeeping (moving current db to db.bak, moving db.new to current, opening the new db, etc.) when it is asked for a location. And every time I've seen it asked for a location I also see a "NlpLocationBackendFuser" log message with the results.

In Settings->Location->Mode what do you have selected? Either "High accuracy" or "Battery saving" should exercise that logic but "Device only" will only use the GPS.

(Using UnifiedNLP with local GSM and my WiFi backend makes it confusing because all modes become "device only" as they don't use a data connection to get the network based location.)

n76 commented 9 years ago

To further clarify the system location settings:

"Device only" --> Only use GPS "Battery saving" --> Only used network location (UnifiedNLP and its backend plug-ins in this case) "High accuracy" --> Use both network location and GPS

If you use any mode with GPS and the GPS location is good (less than threshold) then my WiFi backend you seem to also have installed will start learning the WiFi APs in your area.

Susurrus commented 9 years ago

So I may not have any locations in my area. I've downloaded the My Location Widget and activated it. I only have this location provider enabled. And this is what I see in logcat

D/NlpLocationBackendHelper( 1007): Unbinding from: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.gsmlocation cmp=org.fitchfamily.android.gsmlocation/.GSMService }
D/gsm-backend-service( 1437): Binder CLOSE called
D/NlpLocationBackendHelper( 1007): Binding to: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.gsmlocation cmp=org.fitchfamily.android.gsmlocation/.GSMService }
D/NlpLocationBackendHelper( 1007): Not (yet) bound.
D/NlpLocationBackendHelper( 1007): Bound to: ComponentInfo{org.fitchfamily.android.gsmlocation/org.fitchfamily.android.gsmlocation.GSMService}
D/gsm-backend-service( 1437): Starting location backend
D/gsm-backend-service( 1437): Binder OPEN called
D/gsm-backend-service( 1437): Starting reporter thread
Susurrus commented 9 years ago

I've downloaded a new OpenCell and Mozilla db no problem. Then I launched tried to get my location again and I see this from logcat

D/NlpLocationBackendHelper( 1007): Unbinding from: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.gsmlocation cmp=org.fitchfamily.android.gsmlocation/.GSMService }
D/gsm-backend-service( 1437): Binder CLOSE called
D/NlpLocationBackendHelper( 1007): Binding to: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.gsmlocation cmp=org.fitchfamily.android.gsmlocation/.GSMService }
D/NlpLocationBackendHelper( 1007): Not (yet) bound.
D/NlpLocationBackendHelper( 1007): Bound to: ComponentInfo{org.fitchfamily.android.gsmlocation/org.fitchfamily.android.gsmlocation.GSMService}
D/gsm-backend-service( 1437): Starting location backend
D/gsm-backend-service( 1437): Binder OPEN called
D/gsm-backend-service( 1437): Starting reporter thread
D/gsm-backend-settings( 1437): prefsFragment.onCreate(): ociKeyPreference is OpenCellId API
D/gsm-backend-settings( 1437): prefsFragment.onCreate(): mccFilterPreference is MCC Filter
D/gsm-backend-settings( 1437): Use OpenCellID data = true
D/gsm-backend-settings( 1437): Use Mozilla data = true
D/gsm-backend-settings( 1437): OpenCellId API Key = c40c278a-1c5f-4c12-a9d0-f61f86cba57e
D/gsm-backend-settings( 1437): MCC filtering = 310,311
D/gsm-backend-settings( 1437): Inputs validated: Start background processing...
D/gsm-backend-settings( 1437): Use OpenCellID data = true
D/gsm-backend-settings( 1437): Use Mozilla data = true
D/gsm-backend-settings( 1437): OpenCellId API Key = c40c278a-1c5f-4c12-a9d0-f61f86cba57e
D/gsm-backend-settings( 1437): MCC filtering = 310,311
I/gsm-backend-dlActivity( 1437): onCreate(Bundle)
D/gsm-backend-dlActivity( 1437): Use OpenCellID data = true
D/gsm-backend-dlActivity( 1437): Use Mozilla data = true
D/gsm-backend-dlActivity( 1437): OpenCellId API Key = c40c278a-1c5f-4c12-a9d0-f61f86cba57e
D/gsm-backend-dlActivity( 1437): MCC filtering = 310,311
D/gsm-backend-dlFragment( 1437): downloadDataAsync.setState(0)
D/gsm-backend-dlFragment( 1437): downloadDataAsync:initialize(true, true, "c40c278a-1c5f-4c12-a9d0-f61f86cba57e", "310,311")
D/gsm-backend-dlFragment( 1437): downloadDataAsync: MCC filter: 310,311
I/gsm-backend-dlFragment( 1437): onAttach(Activity)
I/gsm-backend-dlFragment( 1437): onCreate(Bundle)
I/gsm-backend-dlFragment( 1437): onCreate(Bundle)
I/gsm-backend-dlActivity( 1437): onStart()
I/gsm-backend-dlFragment( 1437): onStart()
I/gsm-backend-dlActivity( 1437): onResume()
I/gsm-backend-dlFragment( 1437): onResume()
D/gsm-backend-dlFragment( 1437): downloadDataAsync: Getting Tower Data From Open Cell ID. . .
D/gsm-backend-dlFragment( 1437): downloadDataAsync: URL is http://opencellid.org/downloads/?apiKey=c40c278a-1c5f-4c12-a9d0-f61f86cba57e&filename=cell_towers.csv.gz
D/gsm-backend-dlFragment( 1437): downloadDataAsync: Content length = 162186181
D/gsm-backend-dlFragment( 1437): downloadDataAsync: Records Read: 7177147, Inserted: 910398
D/gsm-backend-dlFragment( 1437): downloadDataAsync: Total Time: 697412ms (0.097ms/record)
D/gsm-backend-dlFragment( 1437): downloadDataAsync: Getting Tower Data From Mozilla Location Services. . .
D/gsm-backend-dlFragment( 1437): downloadDataAsync: URL is https://d17pt8qph6ncyq.cloudfront.net/export/MLS-full-cell-export-2015-02-12T000000.csv.gz
D/gsm-backend-dlFragment( 1437): downloadDataAsync: Content length = 83350826
D/gsm-backend-dlFragment( 1437): downloadDataAsync: Records Read: 3601733, Inserted: 548657
D/gsm-backend-dlFragment( 1437): downloadDataAsync: Total Time: 380650ms (0.106ms/record)
D/gsm-backend-dlFragment( 1437): downloadDataAsync: Creating indicies for faster access.
D/gsm-backend-dlFragment( 1437): downloadDataAsync.setState(3)
D/gsm-backend-dlFragment( 1437): downloadDataAsync: Total Time: 1127331ms
D/gsm-backend-dlFragment( 1437): downloadDataAsync: Finished.
I/gsm-backend-dlActivity( 1437): onPostExecute()
I/gsm-backend-dlActivity( 1437): mButton.onClick: Finish Activity
I/gsm-backend-dlFragment( 1437): onPause()
I/gsm-backend-dlActivity( 1437): onPause()
I/gsm-backend-dlFragment( 1437): onStop()
I/gsm-backend-dlActivity( 1437): onStop()
I/gsm-backend-dlFragment( 1437): onDestroy()
I/gsm-backend-dlFragment( 1437): cancel()
D/gsm-backend-dlFragment( 1437): downloadDataAsync.setState(1)
I/gsm-backend-dlActivity( 1437): onDestroy()
D/NlpLocationBackendHelper( 1007): Unbinding from: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.gsmlocation cmp=org.fitchfamily.android.gsmlocation/.GSMService }
D/gsm-backend-service( 1437): Binder CLOSE called
D/NlpLocationBackendHelper( 1007): Binding to: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.fitchfamily.android.gsmlocation cmp=org.fitchfamily.android.gsmlocation/.GSMService }
D/NlpLocationBackendHelper( 1007): Not (yet) bound.
D/NlpLocationBackendHelper( 1007): Bound to: ComponentInfo{org.fitchfamily.android.gsmlocation/org.fitchfamily.android.gsmlocation.GSMService}
D/gsm-backend-service( 1437): Starting location backend
D/gsm-backend-service( 1437): Binder OPEN called
D/gsm-backend-service( 1437): Starting reporter thread
n76 commented 9 years ago

Could very well be that you are in an area with no towers mapped. That was the case for me when I first started. Near as I can tell, I am the only OpenCellId contributor in my area. And the few Mozilla contributions in my area are widely scattered. In that case I'd expect to see something like the following in logcat:

D/gsm-backend-database( 2992): DB Cursor empty for: mcc=310, mnc=260, lac=4080, cid=151107

Are you comfortable with scripting and/or grep search and replaces? If so, is it possible to grab the database off the phone, munge it into a GPX file and then load it into mapping software to show where the estimated towers positions. You will find that many are obviously incorrect but okay to use as an estimate of coverage area. If you are interested in that, I can walk you through the process off line.

Just to be sure that at least UnifiedNLP is working, enable the wifi backend and set your phone to "High accuracy". With some app the asks for location continuously, like a map display, walk around your neighborhood. It may take a while for the GPS to lock without an assist from network location (at least it does on my phone some newer phones lock pretty fast without assist).

Once you've done that, then set the phone to "Battery saving" so it only uses UnifiedNLP and see if the wifi backend gives you a location. There will need to be at least two WiFi APs detected for a position to be returned.

Susurrus commented 9 years ago

This is fixed as of the latest version. Thanks @n76!