Using the magnetometer to sense a local magnetic field

So, I am trying to use the magnetometer to sense a nearby magnet. The difficulty that I am running into is that I get values from the magnetometer until my phone passes too close to the magnet. It appears that when the values hit 5000 the magnetometer appears to shut down and just pass back zeroes to the app. Zeroes are passed back for about 10 seconds and the the magnetometer appears to reset.

Has anyone experienced this? Does anyone know the magnetometer well enough to have a workaround or know why this occurs?

Thanks for any and all help! Code and video are attached.

Link to Project

[IMG 2501 - YouTube](https://Link to video)