0

Say I have an app that needs to send some small packets from time to time to a server, no particular interval (well maybe a maximum interval). Since one doesn't want to wake the CPU+radio+other SoC crap every time one sends a packet (poor battery!) is it possible (aka is there an API) to send packets to a queue so they are sent as soon as possible preferably next time radio wakes up?

I know it's convoluted but think about it, messages like ping (old WhatsApp versions used to ping server every 30 or 60 seconds) or similar keepalive packets would benefit from this a lot!

David G.F.
  • 162
  • 1
  • 8
  • If there's an event that signified when the radios "wake up", you can just hook onto that. I'll check the autostart s app. – Carcigenicate Jan 23 '17 at 22:54
  • There's a "user present" event that only activates when the user unlocks the keyguard. Closest I could find. – Carcigenicate Jan 23 '17 at 22:57
  • Ha! That's already quite close. My main concert though was about being able to send packages while the user is not using the phone, so that I don't drain battery too much. Of course when user is active we can "safely" assume that sending packets won't drain battery too much (probably radio is on already and CPU is not sleeping). – David G.F. Jan 24 '17 at 18:46
  • Install "autostarts" if you have a rooted phone. It let's you control what apps are allowed to hook onto certain events, and consequently gives you an overview of available events. There may be API to Documentation that lists all events as well. – Carcigenicate Jan 24 '17 at 19:36

0 Answers0