Google developer advocate Colt McAnlis said that Android apps, almost across the board, are not architected correctly for the best networking performance, during a talk he gave Friday at Google’s I/O developer conference in San Francisco.
“Networking performance is one of the most important things that every one of your apps does wrong,” he told the crowd.
+ ALSO ON NETWORK WORLD: Enterprise tech a no-show at Google I/O + Google hypes Android M, Android Pay, Google Photos at I/O 2015 +
By structuring the way apps access the network inefficiently, McAnlis said, developers are imposing needless costs in terms of performance and battery life – costs for which their users are on the hook.
“Bad networking costs your customers money,” he said. “Every rogue request you make, every out-of-sync packet every two-bit image you request, the user has to pay for. Imagine if I went out and told them that."
The key to fixing the problem? Use the radio less, and don’t move so much data around, McAnlis said.
One way to do this is batching, he said – architecting an app such that lower-priority data is sent when a device’s networking hardware has been activated by something else, minimizing the amount of time and energy used by the radio.
Pre-fetching data is another important technique for smoothing out network usage by Android apps, he said.
“If you can somehow sense that you’re going to make six or seven requests in the future, don’t wait for the device to go to sleep and then wake it up again - take advantage of the fact that the chip is awake right now, and make the requests right now,” McAnlis said.
He also urged developers to use Google Cloud Messaging, rather than relying on server polling for updates.
“Polling the server is horrible. … It is a waste of the user’s time,” McAnlis said. “Think about this: Every time you poll the server and it comes back with a null packet, telling you that there’s no new data, the user’s paying for that.”