Optimizing Server-Initiated Network Use

This lesson teaches you to

  1. Send Server Updates with GCM

  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的更多相关文章

  1. Android 性能优化(4)Optimizing Layout Hierarchies:用Hierarchy Viewer和Layoutopt优化布局

    Optimizing Layout Hierarchies This lesson teaches you to Inspect Your Layout Revise Your Layout Use ...

  2. 【腾讯Bugly干货分享】Android性能优化典范——第6季

    本文来自于腾讯bugly开发者社区,非经作者同意,请勿转载,原文地址:http://dev.qq.com/topic/580d91208d80e49771f0a07c 导语 这里是Android性能优 ...

  3. Android性能优化典范第二季

      Google前几天刚发布了Android性能优化典范第2季的课程,一共20个短视频,包括的内容大致有:电量优化,网络优化,Wear上如何做优化,使用对象池来提高效率,LRU Cache,Bitma ...

  4. Android性能优化典范(二)

    Google前几天刚发布了Android性能优化典范第2季的课程,一共20个短视频,包括的内容大致有:电量优化,网络优化,Wear上如何做优化,使用对象池来提高效率,LRU Cache,Bitmap的 ...

  5. Linux/Android 性能优化工具 perf

    /***************************************************************************** * Linux/Android 性能优化工 ...

  6. android app性能优化大汇总(google官方Android性能优化典范 - 第2季)

    Google前几天刚发布了Android性能优化典范第2季的课程,一共20个短视频,包括的内容大致有:电量优化,网络优化,Wear上如何做优化,使用对象池来提高效率,LRU Cache,Bitmap的 ...

  7. Android性能优化典范 - 第2季

    Google发布了Android性能优化典范第2季的课程,一共20个短视频,包括的内容大致有:电量优化,网络优化,Wear上如何做优化,使用对象池来提高效率,LRU Cache,Bitmap的缩放,缓 ...

  8. Android性能优化问题总结

    性能优化这块,分为UI性能优化.内存优化.数据库优化.网络优化.耗电优化等等.可以从1.如何发现问题,2.怎么解决问题,3.解决效果对比,这几个方面去描述.举个简单例子——UI优化,可以从 UI出现什 ...

  9. Android性能优化之渲染

    Google近期在Udacity上发布了Android性能优化的在线课程,目前有三个篇章,分别从渲染,运算与内存,电量三个方面介绍了如何去优化性能,这些课程是Google之前在Youtube上发布的A ...

  10. Android 性能优化探究

    使用ViewStub动态载入布局.避免一些不常常的视图长期握住引用: ViewStub的一些特点: 1. ViewStub仅仅能Inflate一次,之后ViewStub对象被置空:某个被ViewStu ...

随机推荐

  1. MongoDB小结26 - 地理空间索引

    现在有一种查询变得越来越流行(尤其是移动设备):找到离当前位置最近的N个场所. MongoDB专为平面坐标查询做了专门的索引,称为地理空间索引. 同样需要用ensureIndex创建,不过,参数是两个 ...

  2. [转]Attribute在.net编程中的应用

    Attribute在.net编程中的应用(一) Attribute的基本概念 经常有朋友问,Attribute是什么?它有什么用?好像没有这个东东程序也能运行.实际上在.Net中,Attribute是 ...

  3. Android GIS开发系列-- 入门季(13)Gdal简单写个shp文件

    Gdal是用来读写栅格与矢量数据的,在Gdal官网,可以下载相关的资源进行平台的编译.其实Arcgis底层也是用Gdal来读取shp文件的,那在Android中可以直接读写shp文件吗,是可以的.这里 ...

  4. JFinal Weixin 微信极速 SDK

    原文:https://git.oschina.net/jfinal/jfinal-weixin

  5. Setting up Storm and Running Your First Topology

    http://www.haroldnguyen.com/blog/2015/01/setting-up-storm-and-running-your-first-topology/ --------- ...

  6. 【转】学习JavaScript闭包

    原文: http://www.cnblogs.com/Lau7/p/7942100.html#undefined ------------------------------------------- ...

  7. UVa 10534 Wavio Sequence (最长递增子序列 DP 二分)

    Wavio Sequence  Wavio is a sequence of integers. It has some interesting properties. ·  Wavio is of ...

  8. Android之——jni通用工具方法

    转载请注明出处:http://blog.csdn.net/l1028386804/article/details/47002207 1.将java字符串转化为c++字符串 /** *工具方法 *将ja ...

  9. 服务器无法处理请求。 ---> 未将对象引用设置到对象的实例

    服务器无法处理请求. ---> 未将对象引用设置到对象的实例. 简短说下我遇到的问题.webservice部署到服务器上后,访问方法报上面的错误,最终原因为改方法需要操作文件夹,加上了相应的权限 ...

  10. 利用runtime检測这个对象是否存在某属性?

    假定有实例对象-instance,我们怎样知道该实例对象是否存在属性-propertyName? 利用runtime,我们能够获取到它的属性列表 1)属性列表 unsigned int outCoun ...