How to use network location under LineageOS (Android 7.1)

@Roboe I am trying to find out, how I can use network location under Lineage OS without Google Play Store, using microG.
What makes me hesitating just to do it, is the following sentence I have found at WeAreFairphone/flashable-zip_microG:
"After installing one of the below ZIPs, you’ll probably need to update microG Services Core to its latest unstable release."
That sounds, that it doesn’t work properly at the moment? Or do I misunderstand something?

I really would like to get an up-to-date guide, how to install UnifiedNlp network location at my Lineage OS FP2! Any advice or experiences, easy to understand for a layperson like me, is appreciated very much!
Heiner

Hi @Heiner,

I’m using UnifiedNlp on my LineageOS device with Mozilla Location Service. Basically what you need to do is to install UnifiedNlp (no GAPPS) from F-Droid and then any location service provider backend you like (I chose Mozilla).

Reboot your phone after you have installed both, open the UnifiedNlp Settings app and configure/enable your chosen location backend there.

Done, enjoy location fix within seconds :slight_smile:

1 Like

Thanks for the very quick answer! Yes, it works!
What I didn’t know: OsmAnd needs an activ GPS and doesn’t work with network location only, obviously.

I don’t think that’s entirely true. Maybe for navigation. But just to show my location on the map it sometimes works with just NLP - probably depends on the accuracy though.

Yes, you are right! At first I tried it only with navigation and that didn’t work.

Without integrating UnifiedNLP into the system? That shouldn’t work with LOS (Android 7 needs locations providers INSIDE the system).

@heiner Just flash the regular UnifiedNLP zip from here and open UniedNLP settings to enable the providers. microG handles a lot more things than network location.

The sentence you quote from me means microG (not UnifiedNLP) needs to be updated once installed to work with apps using newer versions of the Gobble frameworks, because my zip installs the latest stable version, quite old.

1 Like

Thanks for the heads up, but interestingly it does work for me. I can get a very precise location fix via UnfiedNLP within seconds, before I had UnifiedNLP installed it took several minutes. It seems to work for @Heiner as well.

The Self-Check in the UnifiedNLP Settings app confirms that it is not installed in /system. It is strange, you’re right that it should not work in LineageOS / Android 7, but somehow it does. :confused:

Edit: Well it is broken after a reboot. I will test this in the coming days and report back.

This may be a stupid question but did you test with location setting “battery saving” (=only NLP, no GPS)?

1 Like

I did it that way and it worked as described.

Really weird, seriously. UnifiedNLP shouldn’t work without being integrated into the system. Can you uninstall it from their app info screen?

Only explanation I can think about is fused location mixing things. Fused location is the Android component that manages network and GPS location. It usually uses last-known GPS position to get a quicker fix, so that can be the “network location” your are getting. Try to enable Battery saver location only for a period of time and request location physicaly away of your last GPS location (on a near park while walking your dog, hedgehog, elephant (?) or something).

I tried:
uninstalled unifiedNlp settings,
started OsmAnd+,
result for location: “keine Informationen” (no information)

than I installed “unifiedNlp settings” and “busybox” again,
tried to move unifiedNlp to system with “system app mover”.
Result: “Error: Could not remount /system”.

Any idea what to do?

Doing the integration manually will make you lose it whenever you update the system with OTA upgrades.

I sincerely recommend flashing the ZIP mentioned above, because its clean (just inspect the source or the ZIP itself) and has an OTA survival script. Before flashing it, it’s better you uninstall UnifiedNLP to avoid conflicts and, with such quantity of backends, use the unifiednlp-minimal ZIP flavour.

I can’t assist you with integrating manually APKs in the system with root apps, because I only did it through a root shell right in TWRP. If you choose this path anyway, copy and edit the OTA survival script accordingly to your setup.

/system/addon.d/70-microg.sh

#!/sbin/sh
#
# /system/addon.d/70-microg.sh
# During a system upgrade, this script backs up microG apps,
# /system is formatted and reinstalled, then the files are restored.
#

. /tmp/backuptool.functions

list_files() {
cat <<EOF
priv-app/UnifiedNLP/UnifiedNLP.apk
app/MozillaNlpBackend/MozillaNlpBackend.apk
app/NominatimNlpBackend/NominatimNlpBackend.apk
EOF
}

case "$1" in
  backup)
    list_files | while read FILE DUMMY; do
      backup_file $S/"$FILE"
    done
  ;;
  restore)
    list_files | while read FILE REPLACEMENT; do
      R=""
      [ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
      [ -f "$C/$S/$FILE" ] && restore_file $S/"$FILE" "$R"
    done
  ;;
  pre-backup)
    # Stub
  ;;
  post-backup)
    # Stub
  ;;
  pre-restore)
    # Stub
  ;;
  post-restore)
    # Stub
  ;;
esac
1 Like

Now I did it that way. As a result I have got the UnifiedNlp app registert in system!
On the other side: I tried again network location at the OsmAnd+ app and I got a place, some five kilometers away from the place I am. I will have to find out why.

Edit:
I tried some more configurations to get better results for network location, but without success. The network location within whether forecast apps is sufficient, but within the OsmAnd+ app its far away from the real location (about 5 to 10 km distance). With GPS activated the location is fine.
My conclusion: I didn’t configure the used backends properly, otherwise the results with network location are just as imprecise as it shows at my device?
Before I installed the UnifiedNlp properly registert in system, the network location was much more exact as it is now. I suppose, that with installing the UnifiedNlp not as a system app, the settings of location doesn’t work as settled, the GPS location may have been active although it has been switched off.
I really would like to see your comments to these speculations! And maybe you can give some advice how to configure the location backends properly?
Heiner

1 Like

This topic was automatically closed after 183 days. New replies are no longer allowed.