How can I prevent the battery in my Nexus S from draining overnight? I have a Google Nexus S and for the past 2-3 days whenever I go to sleep the battery drains completely overnight. I mean when I go to bed the charge on my phone is plus 90% but for the past 2 days it's dead when I wake up. Thankfully I didn't miss work these two days otherwise my boss is gonna kill me.

I have Android 2.3.7

Any advice?
There are several things which can be done. Most obvious is to switch it off completely (grin), but that only as a side note. Also, switching it to Airplane mode falls close -- though, when used with a "timer" (via automation apps such as Tasker or Llama), it can be quite a useful thing to not only save some juice over night, but also care for some silence. Another obvious option is to connect it to some power source, which clearly prevents it from running out of juice. But these are just general rules.

In your special case, the problem is some app draining your battery over night. True, above mentioned solutions would take care that there's enough juice left -- but still that's a misbehaving app. So first thing I would do is, after it drained a little (but still enough juice is left, say 30% or more to be sure), go and check your battery stats. You will find them in your system settings, on most devices it is in Settings &rarr; About Phone &rarr; Battery Use. This should list the most heavy consumers, and your candidate should be on the very top.

Other useful sources on this topic (and here at Android Enthusiasts) include:


How to deal with (orphaned) WakeLocks? (especially when you cannot find the "evil app" in the consumers list)
How can I tell what is really draining my battery?
What can I do to increase battery life on my Android device?