2

I'm writing a tool to test battery life on tablets. One aspect of this test is to see how long it takes to add 10% to the state of charge. I can sample SOC through the Battery API, and I can keep track of time so I know how long it takes to charge a certain amount. However this all grinds to a halt if the tablet goes to sleep. I keep the device awake for discharge testing, but this would make it take longer to charge so I'd rather not do it when charging.

Is there any way to keep javascript running when the tablet is asleep? I'm pretty sure the answer is something along the lines of "Hell, no, go look up the definition of 'sleep'" but I'm hoping there's some way to, e.g. fire an event at a future time to wake up and look at things. The goal is to do this entirely client-side from a website without installing anything on the device.

Notifications allow me to get attention when I'm minimized or blurred, but I don't think notifications can wake up the client, right?

The closest I found was this discussion which seems to confirm that asleep means asleep but hey -- hope springs eternal...

Community
  • 1
  • 1
Crash Gordon
  • 159
  • 7
  • Are you running it in a browser... my guess is no. – epascarello May 02 '17 at 16:55
  • If you write a small hybrid app that the javascript can invoke, you might be able to spawn some background process that survives a sleep, but don't quote me on that. – code11 May 02 '17 at 18:33

0 Answers0