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. JDK源码解析(一)ArrayList源码解析

    这里为了方便写注释,我是把ArrayList的源码复制下来放到自己创建的类里面的 这个变量则指向具体存放数据的数组 看下构造函数吧 点进去看下LinkedList是怎么数组化的 很弱智吧,就是创建一个 ...

  2. 跪啃SAM

    struct SAM { ],size,last,pre[maxn],pos[maxn]; SAM() { size=; memset(ch[],,])); pre[]=-; } int idx(ch ...

  3. 原 linux添加虚拟ip(手动vip和keepalived方式)

    https://blog.csdn.net/dear_snowing/article/details/68066544 https://www.cnblogs.com/liuyisai/p/59906 ...

  4. 洛谷——P1007 独木桥

    P1007 独木桥 题目背景 战争已经进入到紧要时间.你是运输小队长,正在率领运输部队向前线运送物资.运输任务像做题一样的无聊.你希望找些刺激,于是命令你的士兵们到前方的一座独木桥上欣赏风景,而你留在 ...

  5. html自动换行

    对于div,p等块级元素 正常文字的换行(亚洲文字和非亚洲文字)元素拥有默认的white-space:normal,当定义的宽度之后自动换行html css 1.(IE浏览器)连续的英文字符和阿拉伯数 ...

  6. dubbo服务的group和version

    group 当一个接口有多种实现时,可以用group区分 <!-- dubbo group 使用示例 --> <bean id="demoA" class=&qu ...

  7. component and slot

    component and slot 使用: 1.component panel <article class="message"> <div class=&qu ...

  8. golang 跨平台编译——go 在windows上编译Linux平台的程序(Cross Compilation from Windows to Linux/Ubuntu)

    Go Cross Compilation from Windows to Linux/Ubuntu I have GO 1.7 installed on my Windows 10. I create ...

  9. NYOJ 496 [巡回赛-拓扑排序]

    链接:click here 题意: 巡回赛 时间限制:1000 ms  |  内存限制:65535 KB 难度:3 描写叙述 世界拳击协会(WBA)是历史最悠久的世界性拳击组织,孕育了众多的世界冠军, ...

  10. __init__、__str__、__del__方法

    1.def__init__()方法: class Cat: """定义了一个Cat类""" #初始化对象 def __init__(self ...