HTC One M8 resets some settings every time battery dies Every time my HTC One M8's battery dies, which is roughly once every two weeks, when I charge it and turn it on, a large portion of random settings or configurations are reset to default on the device. This time it happened, it actually erased all of the contacts on my phone, and previously, it's logged me out of all my apps, reset my theme-ing options, and erased all of my music. 

Why is that happening? Can I prevent it from happening in the future? Configuring my phone like it's a new device every time the battery dies is quite painful.

The device is on Stock Android 6, latest version available to me (No S-off or Root), and running Sense 7.
Firstly, letting the battery run dry and then charge (deep discharge) is harmful to the life of battery and is never recommended in normal usage
Perhaps, this has caused the battery reset logic to go awry. I am not sure how this would cause the reset of your device, but as an interim measure resetting battery logic as recommended  below may help 


This was the reply to user whose device would not turn on after deep discharge on ifixit


  Have you tried to reset the charging logic of the device, first you must charge your M8 for a minimum of 10 minutes using a wall charger. With the power off, press down and hold the volume up and down button with the power button for approximately 2 minutes. After 2 minutes, release all of the buttons. After the release the charging logic should be reset. Then charge your phone to 100% using your wall charger. 



After doing above, use your device and charge the battery when it falls to 20℅


This may help fix the issue, if it doesn't, at least the battery connection with your problem is ruled out. From the information supplied by you it appears to be linked to battery only