Basically we are pinging to gosquared every 20 seconds for real time analytics, even when the back is in the background.
Yeah, don’t do that, it’ll severely reduce battery life. Even if you had direct control over the networking hardware, and could thus force it to power up and power down at will, which you don’t, pinging the network every 20 seconds would still severely reduce battery life. Some network interface specs require that the hardware stay active for a certain minimum amount of time, and that time is of the order of tens of seconds, so pinging every 20 seconds is basically keeping that interface in a high power state continuously.
You need to change your approach. I recommend that you do this work server side, and then use push notifications to tell the device that something noteworthy has occurred.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"