Nexus 5 - GPS Fix

Issue:
Nexus 5 GPS gets a satellite lock, then loses it. Sometimes the GPS will reset and try to get a lock again.
Even when it gets a satellite lock it seems like the GPS will just freeze up or "die". Anything using the GPS for location will simply be unable to determine your location.

This was first reported back in November 2014, and as of August 2016 it still has NOT been fixed by Google!

Original Google bug report thread:
https://code.google.com/p/android/issues/detail?id=81140

Cause: ???

Post #474 in September of 2015 is from a Google Project Member. They suggested that it might be an issue with incorrect APN settings. Their suggestion to modify your APN setting does no good if you do not have an APN menu, which is the case with many Nexus 5 users on a CDMA network (such as Sprint). Several users also said that updating their APN made no difference.

In March of 2016, one user in Post #695 gave some information that looked promising. They said that when they disabled MSB (Mobile Station Based) GPS updates, it fixed the issue for them.

I tried their suggestion on my device... and my GPS has not "died" on me since! When my device gets a lock, it keeps the lock.

Solution:
Disable MSB updates by modifying the /system/etc/gps.conf file and changing the "capabilities" line.

This isn't a true fix or solution, just a work-around. But it has definitely fixed the issue on my device!

I've made an update zip that can be flashed from Recovery, such as TWRP. Since this is flashed from Recovery, your device does not have to be rooted (but it does need to be unlocked in order to boot TWRP). Please note that by modifying your /system partition, OTA updates may fail. You can still use the official Nexus factory images from Google to update your device.

I've used this with CyanogenMod 13.0, April/May/June builds, and with Stock Android 6.0.1 from Google, April/May/June builds (MOB30D, MOB30H, and MOB30M). It should work on any builds of Android 5.0 and newer.

Nexus 5 GPS Update (changes 0x33 to 0x31 to disable MSB updates):
N5_GPS_Fix.zip (~2KB)

The zip files contain no binary, just an update script. It mounts /system and runs this command:

sed -i -e 's/CAPABILITIES=0x33/CAPABILITIES=0x31/g' /system/etc/gps.conf

(it changes the "0x33" part to "0x31" in the GPS configuration file)

In addition to changing the current GPS configuration, it copies another script to /system/addon.d so that the fix can persist through upgrades.


Installation Instructions:

1) Copy the "N5_GPS_Fix" zip file to your device.
2) Boot into Recovery / TWRP.
3) Flash the "N5_GPS_Fix" zip file.
4) Reboot your device.


The GPS Test program is good for testing satellite locks.

GPS Test

GPS Test Plus