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


ianhughes74

Members
Jan 6, 2018
14
15
*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.
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
optimizedgpsconf.zip
 
Last edited:
I hope I've helped. Please, if someone test this give me some feedback if it worked for you.
Thanks
 
I've put your GPS.conf on latest 9.2 stable

I'll let you know

Inviato dal mio MI 5 utilizzando Tapatalk
 
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:
Fix after 7 minutes on the second try

Inviato dal mio MI 5 utilizzando Tapatalk
I don't believe it. Did you follow all the steps on my tutorial? It's not just about replace the gps.conf file. Read again with attention!
 
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.
 
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!
 
Ok thanks, for now i have always accuracy problem, specialty in my car because of atermic glass.
 
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.
 
Will this fix the problems with the Xiaomi Mi8 GPS?
Is it already included on its xiaomi.eu ROM?
 
*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.
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
optimizedgpsconf.zip


Hi,

Why i should not replace gpsconf with twrp instead of using magisk???
 
  • Like
Reactions: skan
[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.

Hello is that optimizedgpsconf.zip file just for the Mi5 or will also improve the GPS on my Mi8 with Android 8.1?

Aren't these optimizations already included on the latest Xiaomi.eu ROMs?

When will we be able to use the dual (L1+L5) signal?
 
Last edited:
OK. I've tried on my Xiaomi Mi8 with Xiaomi.eu 8.8.30 and it doesn't improve nor worsen the GPS, it's just the same.
 
On the Redmi 4 Prime the GPS will work with
# supl version 1.0
SUPL_VER=0x20000

But not 3.

Set the 3 the GPS fails to work at all in my test.

Also it does not load Xtra data only AGPS