[Magisk Module] Step By Step Definitive Gps Solution (global)


Jan 6, 2018
14
4
15
#1
*This module also works for any another device with Qualcomm Snapdragon chipset based, so feel free to test it on another device that have Magisk and recommend for your friends that want a better GPS experience and functionality.

The original gps.conf file present in any version of MIUI is very wrong, it has a lot of bad information and settings for the correct operation of the GPS and A-GPS. In my video on this thread that I compare the native MIUI file with my edited file, you'll see the big difference with a lot of bad settings and a lot of # that precedes relevant information, this aborts/cancels the line.
So, I've made changes for a better optimization that have the best results.

A little reflection tested and proven by myself: If you have a nice firmware version with wrong gps.conf you won't have good results with the GPS, but if you have any firmware version with gps.conf file correctly edited, maybe you might get better results.
Then we can finally conclude that, the Xiaomi Mi5 don't have any hardware problem with GPS. What happens is that the firmware works in conjunction with the file.

Explaining some of my changes:
1 - Now basically the A-GPS data files are XTRA 3.0 files (It provides GPS, GLO and BDS assistance data) served over HTTPS with SSL and without # preceding the address lines while the default was XTRA 2.0 (provides only GPS and GLO) served over HTTP without SSL, this allows an attacker to mount a MITM attack on the network level and modify the GPS assistance data while in transit.
2 - I switched the XTRA_VERSION_CHECK from 0 to 3 because it's obvious that xtra3grc.bin are XTRA 3.0 files.
3- I included the address servers from pool.ntp.org as the main NTP server because it's global, the system will try finding the closest available servers for you. (in my video you'll se my daily file with brazilian servers, don't worry.)
4 - I set SUPL_HOST google.com as default, before was qxwz.com and this is an A-GPS server in China. Google server is more "Global" and can do the job very well.
5 - I updated the SUPL version from 2.0 to 3.0
6 - I changed the SUPL_MODE from 3 (so bad, this option doesn't even exist) to 0x2 (MSA), under normal circumstances, the MSA method is applicable to situation which the satellite signal is poor, to achieve a single positioning.
7 - Changed the value of GPS CAPABILITIES from 0x37 to 0x35 for correctly MSA mode functionality.
8 - Changed the LTE Positioning Profile Settings from 0 (RRLP) to 3 (LPP_User_Plane and LPP_Control_Plane)
9 - Changed the A-GLONASS Positioning Protocol from 0 to 0x4 (LLP Uplane)
The reason for the 8 and 9 changes is because SUPL 3.0 doesn't support RRC and RRLP anymore.

[Step By Step]
It's Magisk install-able, don't install it by TWRP but with Magisk instead!
1 - Go on Magisk > Modules > Click on "+" yellow button > Search and find this "optimizedgpsconf.zip" (Now this one and only works fine for both Nougat and Oreo and also is correctly replacing the gps.conf file), long press on it and select open and after installed then reboot your device.
2 - Make sure your location settings is setup on mode "High accuracy"
3 - Skirt outdoors, can be in the yard of your house or anywhere else with a line of sight to the sky, download some Compass app on Google Play Store (I recommend the Compass Steel 3D) and then calibrate the compass.
4 - Stay in that outdoor place and download GPS Locker on Google Play Store and open the app and wait for the first time fix/lock. This is necessary and essential because the app will recognize some GPS satellites signals for the very first time.

*Note 1 - Location mode "Battery saving" is gone due to Google's location accuracy is now a binary setting.
*Note 2 - Consider using the GPS Locker app because it is much better than the GPS Test and GPS Data. You just need to open it once and wait for fix, then your gps signal is locked and when you close it the app keep awake running in the background. (press Cancel in "Unlock GPS on exit" message). GPS was made to work on outdoor places. For indoor/enclosed places such as inside of your house don't forget that, it will take a few minutes to fix. It drains more battery, but is required if you're an advanced user that use gps all the time.
Whenever I'm on the street I keep the GPS Locker and Cellular data open because I use Cerberus antitheft, so if I get mugged or if I lose my phone I can track him down and retrieve it.
optimizedgpsconf.zip
 
Last edited:
Dec 30, 2017
10
2
5
#6
hi, i testet your gps config now for a few days and it works really well.
it makes the xiaomi mi5 gps in android 7 finally usable again. it sometimes jumps a bit around in accuracy, but thats not the gps.conf fault, but android 7 or more acurate the xiaomi firmware on android 7

i tested your config with miui 8.1.4.0 global which is the latest with android 6 and there it is just excellent.
it got down to 3m and stayed there very reliably

i tested the difference with android 6 and 7 before and wrote the results in this thread: http://en.miui.com/thread-1133678-1-1.html

so long story short. your gps.conf makes gps on miui9/android7 on xiaomi mi5 finally usable again. on miui8/android 6 its just unbeatable :)
 
Last edited:
Jan 6, 2018
14
4
15
#9
hi, i testet your gps config now for a few days and it works really well.
it makes the xiaomi mi5 gps in android 7 finally usable again. it sometimes jumps a bit around in accuracy, but thats not the gps.conf fault, but android 7 or more acurate the xiaomi firmware on android 7

i tested your config with miui 8.1.4.0 global which is the latest with android 6 and there it is just excellent.
it got down to 3m and stayed there very reliably

i tested the difference with android 6 and 7 before and wrote the results in this thread: http://en.miui.com/thread-1133678-1-1.html

so long story short. your gps.conf makes gps on miui9/android7 on xiaomi mi5 finally usable again. on miui8/android 6 its just unbeatable :)
Thanks for the good feedback, brother. On Android 8.1.0 Oreo my accuracy in outdoor places is 3m too, but on any Android 7 Nougat ROM it got 4m.
 
Jan 6, 2018
14
4
15
#14
The old ones .zip modules was not replacing the gps.conf file - Now I updated and fixed it and this one and only works fine for both Nougat and Oreo and also is correctly replacing the gps.conf file. Check and Download it on attached files at the first page of this thread. Thanks!
 
Dec 19, 2016
8
1
15
#16
Gps good in outdoor but accuracy bad in my car :(
I think the only solution is a update to add Galileo Gps in our Mi 5.