Android 性能优化(9)网络优化( 5)Optimizing Server-Initiated Network Use
Optimizing Server-Initiated Network Use
This lesson teaches you to
Network traffic sent by server programs to your app can be challenging to optimize. A solution to this problem is for your appp to periodically poll the server to check for updates. This approach can waste network connection and power when your app starts up a device's radio, only to receive an answer that no new data is available. A far more efficient approach would be for the to notify your app when it has new data, but figuring out how to send a notification from your server to potentially thousands of devices was previously no easy feat.
The Google Cloud Messaging (GCM) service solves this communication problem by allowing your servers to send notifications to instances of your app wherever they are installed, enabling greater network efficiency and lowering power usage.
This lesson teaches you how to apply the GCM service to reduce network use for server-initiated actions and reduce battery consumption.
Send Server Updates with GCM
Google Cloud Messaging (GCM) is a lightweight mechanism used to transmit brief messages from an app server to your app. Using GCM, your app server uses a message-passing mechanism to notify your app that there is new data available. This approach eliminates network traffic that your app would perform, by not contacting a backend server for new data when no data is available.
An example use of GCM is an app that lists speaker sessions at a conference. When sessions are updated on your server, the server sends a brief message to your app telling it updates are available. Your app can then call the server to update the sessions on the device only when the server has new data.
GCM is more efficient than having your app poll for changes on the server. The GCM service eliminates unnecessary connections where polling would return no updates, and it avoids running periodic network requests that could cause a device's radio to power up. Since GCM can be used by many apps, using it in your app reduces the total number of network connections needed on a device and allows the device radio to sleep more often.
For more information about GCM and how to implement it for your app, see Google Cloud Messaging.
Note: When using GCM, your app can pass messages in normal or high priority. Your server should typically use normal priority to deliver messages. Using this priority level prevents devices from being woken up if they are inactive and in a low-power Doze state. Use high priority messages only if absolutely required.
Android 性能优化(9)网络优化( 5)Optimizing Server-Initiated Network Use的更多相关文章
- Android 性能优化(4)Optimizing Layout Hierarchies:用Hierarchy Viewer和Layoutopt优化布局
Optimizing Layout Hierarchies This lesson teaches you to Inspect Your Layout Revise Your Layout Use ...
- 【腾讯Bugly干货分享】Android性能优化典范——第6季
本文来自于腾讯bugly开发者社区,非经作者同意,请勿转载,原文地址:http://dev.qq.com/topic/580d91208d80e49771f0a07c 导语 这里是Android性能优 ...
- Android性能优化典范第二季
Google前几天刚发布了Android性能优化典范第2季的课程,一共20个短视频,包括的内容大致有:电量优化,网络优化,Wear上如何做优化,使用对象池来提高效率,LRU Cache,Bitma ...
- Android性能优化典范(二)
Google前几天刚发布了Android性能优化典范第2季的课程,一共20个短视频,包括的内容大致有:电量优化,网络优化,Wear上如何做优化,使用对象池来提高效率,LRU Cache,Bitmap的 ...
- Linux/Android 性能优化工具 perf
/***************************************************************************** * Linux/Android 性能优化工 ...
- android app性能优化大汇总(google官方Android性能优化典范 - 第2季)
Google前几天刚发布了Android性能优化典范第2季的课程,一共20个短视频,包括的内容大致有:电量优化,网络优化,Wear上如何做优化,使用对象池来提高效率,LRU Cache,Bitmap的 ...
- Android性能优化典范 - 第2季
Google发布了Android性能优化典范第2季的课程,一共20个短视频,包括的内容大致有:电量优化,网络优化,Wear上如何做优化,使用对象池来提高效率,LRU Cache,Bitmap的缩放,缓 ...
- Android性能优化问题总结
性能优化这块,分为UI性能优化.内存优化.数据库优化.网络优化.耗电优化等等.可以从1.如何发现问题,2.怎么解决问题,3.解决效果对比,这几个方面去描述.举个简单例子——UI优化,可以从 UI出现什 ...
- Android性能优化之渲染
Google近期在Udacity上发布了Android性能优化的在线课程,目前有三个篇章,分别从渲染,运算与内存,电量三个方面介绍了如何去优化性能,这些课程是Google之前在Youtube上发布的A ...
- Android 性能优化探究
使用ViewStub动态载入布局.避免一些不常常的视图长期握住引用: ViewStub的一些特点: 1. ViewStub仅仅能Inflate一次,之后ViewStub对象被置空:某个被ViewStu ...
随机推荐
- 【进击后端】linux安装最新版nodejs
nodejs下载:https://nodejs.org/zh-cn/download/ 1.cd /root/download 2.wget https://nodejs.org/dist/v6.11 ...
- cogs——2419. [HZOI 2016]公路修建2
2419. [HZOI 2016]公路修建2 ★☆ 输入文件:hzoi_road2.in 输出文件:hzoi_road2.out 简单对比时间限制:1 s 内存限制:128 MB [题 ...
- Oracle中,利用sql语句中的函数实现保留两位小数和四舍五入保留两位小数
Oracle中,利用sql语句中的函数实现保留两位小数和四舍五入保留两位小数: select trunc(1.23856789,2) from dual round(m,n) 可以四舍五入 trunc ...
- Sqlserver数据库发送邮件
目录 1. Sqlserver数据库发送邮件 1.1. 概念了解 1.2. 配置 1.3. 测试发送邮件 1.3.1. 代码测试 1.3.2. 工具测试 1.4. 查看邮件日志 1. Sqlserve ...
- 在ASP.NET Core 中使用Cookie中间件 (.net core 1.x适用)
在ASP.NET Core 中使用Cookie中间件 ASP.NET Core 提供了Cookie中间件来序列化用户主题到一个加密的Cookie中并且在后来的请求中校验这个Cookie,再现用户并且分 ...
- Cts框架解析(2)-cts调试环境的搭建
上一篇文章中说了怎样在windows搭建cts以及执行cts进行測试.这篇文章来讲讲怎样在eclipse中配置源代码,进行debug调试. 下载 cts源代码地址:https://android.go ...
- 【CV论文阅读】+【搬运工】LocNet: Improving Localization Accuracy for Object Detection + A Theoretical analysis of feature pooling in Visual Recognition
论文的关注点在于如何提高bounding box的定位,使用的是概率的预测形式,模型的基础是region proposal.论文提出一个locNet的深度网络,不在依赖于回归方程.论文中提到locne ...
- SaltStack学习系列之state常用模块
常用模块:cron,cmd,file,mount,ntp,pkg,service,user,group cmd模块 参数: name:要执行的命令 unless:用于检查的命令,只有unless指向的 ...
- c# Winform上传文件
http://blog.csdn.net/shihuan10430049/article/details/3734398这个代码有点问题 http://blogs.msdn.com/b/johan/a ...
- initial ram filesystem
1 制作最简单的initramfs 1.1 创建init #include <stdio.h> int main() { printf ("\n"); printf ( ...