'Location issue in China with LineageOS on XiaoMi Violet

Short Version: The Chinese Xiaomi Phone with a custom ROM (LineageOS) isn't giving a precise location in China

Long version: I have Xiaomi Redmi Note 7 Pro (Violet) that I recently flashed an unofficial LineageOS 17.1 (last build by Merouth) to it. I used the vanilla version without the Gapps, patched it to enable signature spoofing using Nanodroid Patcher, to install MicroG.

And rooted it using Magisk. Everything is working fine, and the build is stable so far (payments, WeChat, and even a bank app). The problem is with location. First of all, although MicroG says UnifiedNlp is installed, I don't seem to find it in MicroG settings; it just doesn't exist. When I go to MicroG SettingsLocation Modules, I find the other location services that I installed myself (Mozilla Location, GSM, Dèja Vu and Nomimatim) and also when I go to MicroG SettingsSelf-Check, the last item there. It is "Battery Optimizations Ignored", but there isn't any UnifiedNlp status or anything.

Nevertheless, when I go to MicroG SettingsAbout MicroG Service Core, I read that "UnifiedNlp 2.0-alpha6" is among the 'included libraries". I am not sure if this is something related to me not having an accurate location, or is it something that has been changed by MicroG itself recently to be just look like that.

Anyway, I tried to make the UnifiedNlp visible on the MicroG setting, but then I just ignored it, and it didn't seem that I am able to do anything.

I installed two Chinese maps, Baidu and Amap, and it seems that I would have a quite accurate location of where I am when I am on Wi-Fi, but it is not the case when I am on mobile data. It is always shifted by 500-700 m. I read about the different location system China is using, the GCJ-02, and how is that making GPS and Google Maps is always shifting and never gives an accurate location, and that there is this code that corrects the shift. But I am already using Chinese maps, with a Chinese phone. When I tried a location with two other XiaoMi phones (ginkgo and Cepheus) with MIUI stock ROMs, they gave quite precise locations, even without any without or mobile data connections.

So....How can I correct that? Is there a way to apply that shifting code to the maps?

Or is there something else those stock ROMs are adding that makes the maps give better location.

I found these two tools Baidu Unifiednlp Backend and Amap UnifiedNlp Backened they are both available on GitLab as well. But nothing changed after installing both of them, plus they are really data hungry. They access your location all the time in the background.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source