microg / IchnaeaNlpBackend

Backend for UnifiedNlp that uses Mozilla Location Service for geolocation.
116 stars 29 forks source link

Android 10 / LOS 17.1: Requests location every 60 seconds #55

Open pjaap opened 3 years ago

pjaap commented 3 years ago

Hi. I'm using Lineage OS for MicroG 17.1:

The Mozilla UnifiedNLP requests the location every 60 seconds if I enable location services. It shows the GPS icon for a few seconds and this repeats every minute.

In the location settings I figured out that the requests are made by Mozilla UnifiedNLP.

The behavior stops if I allow the location permission only if in foreground, but, unfortunately, the NLP stops working at all then.

What can I do to debug this issue?

kaoneko commented 3 years ago

Hi, I noticed the same but with the AppleWifiNlpBackend. It seems to coincide with lines like

LOWI-8.6.0.33: [LOWI-Scan] lowi_close_record:Scan done in 13424819ms, 20 APs in scan results

when viewing logcat, which also occur when the NlpBackend is turned off (the location icon being shown for a few seconds only happens with the NlpBackend on though). I think this LOWI-Scan is just the normal scanning for wireless networks.

It doesn't coincide with log messages from AppleNlpBackendService, which only occur when actually using location in an app, e.g.

AppleNlpBackendService: onOpen AppleNlpBackendService: Found 20 wifis, of whom 18 with location and 1 unknown. AppleNlpBackendService: Requesting Apple for 1 locations AppleNlpBackendService: Found 20 wifis, of whom 19 with location and 0 unknown. AppleNlpBackendService: onClose

But indeed, when you go to Settings > Location, although the UnifiedNlp backend isn't shown under Recent location requests, when you tap App permission it will indeed show that, in my case, Apple UnifiedNlp Backend last accessed location this or the previous minute. When you actually use location in an app, what's shown under Recent location requests in Settings > Location is microG Services Core.

So what's going on here? Is the Mozilla or Apple backend just taking notes whenever a new wifi scan happens, without contacting Mozilla / Apple? I'd like to think so, but I'm just guessing here.

Note that what OP describes also stops happening when I turn off wifi (I have no SIM card in the phone so there is no data connection).

Hope this helps anyone...

breversa commented 3 years ago

How did you manage to get this to work in the first place ? I'm having https://github.com/microg/IchnaeaNlpBackend/issues/52 on LineageOS 17.1…

pjaap commented 3 years ago

I simply installed the "official" build from https://lineage.microg.org/ and ran the self-check in the MicroG app. A one point in time I had to clear the cache of the NLP backend to make it work again (after an update). Wifi+Cell location are working. It takes a few seconds. Best way to check is "Sat-Stat" from F-Droid.

breversa commented 3 years ago

Thanks for your fast reply. I'm a long-time user of Satstat myself, but there's no LineageOS for MicroG for my device, so I installed MicroG via https://github.com/FriendlyNeighborhoodShane/MinMicroG_releases.

It works fine for other location backends but not MLS…

EDIT : SOLVED : https://github.com/microg/IchnaeaNlpBackend/issues/52#issuecomment-861538815 !

daniellandau commented 1 year ago

I recently installed Android 12 (lineageos for microg 19) and the location notification is green, more prominent and takes full screen video out of full screen. Any idea where this should or could be fixed? I haven't used Android with Google in years, but I can't imagine it would have this issue.

pjaap commented 1 year ago

The GSM Core release https://github.com/microg/GmsCore/releases/tag/v0.2.28.231657 resolved this issue for me. The Mozillla NLP is now directly integrated into GSM Core and works flawlessly. Tanks for the effort 🙂