Google应用在Android上的Push机制以及C2DM框架的底层实现

Android C2DM基本原理浅析 Android C2DM基本原理浅析 一、 基本原理 Android从2.2版本开始增加了Cloud to Device Messaging(C2DM)框架,在系统中支持了Push功能。C2DM目前还处在实验室阶段,还不能大规模使用,但是小 阅读详情
GMS (Google Mobile Applications)在Android平台使用了Push机制, 所以有更好的用户体验:当服务器上有你的新的的Gmail邮件, 或者有新的Calendar Events, 或者有新的Contact, 你的Android总会第一时间知道, 并且会自动sync下来. 这里用到的就是Push机制. Google在Android上的Push机制利用的就是XMPP协议, 再加上Android上的GTalk客户端也是利用XMPP协议, 所以底层用的是同一个XMPP框架, 协议的实现是开源的Smack.

在Android 2.2版本FroYo之前, Google的Push机制直接就是利用XMPP协议的extension,也就是在<message>元素下加入自定义的子元素, 但自从FroYo, Android引入了一个新的框架C2DM(Cloud to Device Messaging), 而Google的Pushing 机制变成使用C2DM框架. 那C2DM框架的原理是什么呢? XMPP! 所以, C2DM只不过是在XMPP协议基础上的一套机制, 一个标准API而已. 



海外APP推送(上篇):厂商通道与谷歌FCM通道的差异 顾名思义,厂商通道就是指手机硬件厂商提供的系统级别的推送通道,因为是系统服务,随着设备开机后就一直存在着,有效的保证了推送通道长连接的高可用性。在海外,由于安卓系统默认支持谷歌FCM通道,且网络环境不受地域限制,因此厂商未对出口海外版的手机进行GMS的阉割,而是保留厂商通道与谷歌FCM通道共存的方式。对于这个规则,起初我们也是持有怀疑态度,如果这样的话,那与APP自己实现消息推送相比,就没有高可用的通道服务的优势了,难道只是为了帮助开发者简化推送服务的实现流程,降低开发成本?首先看推送API的响应,正常。. 阅读详情

相关推荐

gms-push-demo:适用于 Android 的 Genesys 移动服务推送通知演示

gms-push-demo 适用于 Android 的 Genesys 移动服务推送通知演示

Android谷歌推送

Android谷歌推送 1.    简介 Android谷歌推送GCM(全称Google Cloud Messaging),谷歌云通讯,它可以实现消息从服务器端推送到android系统相关的应用上,从而实现服务器主动推送消息到android终端的功能。FCM(FireBaseCloud Messaging)是谷歌在2016年Google在I/O大会推出的最新的Android系统级别的消息推送服

我是一只小菜鸟,飞丫飞丫飞~~~ 1万+

告别臃肿VS!仅用Visual Studio 2022 Build Tools为Qt 5.12.12配置MSVC2017开发环境

本文详细介绍了如何仅使用Visual Studio 2022 Build Tools为Qt 5.12.12配置MSVC2017开发环境,避免安装臃肿的完整VS。通过精准选择组件、配置Qt Creator编译器和优化Kit设置,实现高效、精简的Windows平台Qt开发环境搭建,特别适合追求性能和资源优化的开发者。

weixin_30340617的博客 358

通过代码及流程图说明Google在Android上的Push机制的实现

http://mysuperbaby.iteye.com/blog/902054 Google从FroYo版本后引入了C2DM (Cloud to Device Messaging)框架:  http://code.google.com/android/c2dm/index.html  Android Cloud to Device Messaging (C2DM) is a servi

xyxjn的专栏 2728

<蓝桥杯软件赛>零基础备赛20周--第16周--GCD和LCM

gcd,lcm

罗勇军的博客 7617

无人机频谱侦测与智能识别技术实战解析

本文深入解析无人机频谱侦测与智能识别技术实战应用,涵盖无线电侦测、信号处理和定位技术等核心内容。通过频谱分析、特征提取和机器学习算法优化,实现高精度无人机识别与定位,并分享复杂环境下的应对策略和系统集成经验。

weixin_28419039的博客 498

Android C2DM学习——客户端代码开发

一.基础知识在前一部分中,我们从整体上快速介绍并实现了下Android C2DM的Push功能,在接下来的部分里,我们先来回顾一下C2DM相关的整体上的知识,然后具体介绍说明实现的过程。在前面的C2DM框架说明中,我们已经知道,要实现Android的C2DM推送功能,需要涉及到三

ichliebephone的专栏 1万+

FFmpeg音频转换避坑实录:为什么VOS的REC转MP3比WAV转MP3体积小一半?

本文深入解析了FFmpeg在VOS系统REC格式音频转换中的优化技巧,揭示了REC转MP3比WAV转MP3体积小一半的原因。通过分析REC格式的压缩特性、转码参数陷阱及FFmpeg调优方法,帮助开发者实现高效音频转换,显著降低存储成本。

weixin_30752699的博客 531

android push机制-C2DM

http://bigcat.easymorse.com/?p=1210       参考http://code.google.com/intl/zh-CN/android/c2dm/index.html#intro android2.2以上支持,支持第三方应用程序的push。实现令人心动的消息push,GMail就是这么实现的,收信的速度比网页还快。 Components: 1,移动设备:...

sym19862006的专栏 1455

MPU6050 加速度计和陀螺仪传感器与 Arduino 的接口

虽然该模型并不能准确代表现实世界中加速度计传感器的构建方式,但它通常有助于理解为什么加速度计的输出信号通常以 ±g 为单位指定,或者为什么加速度计在静止时在 z 轴上的读数为 1g,或者在不同方向上您可以期望得到什么样的加速度计读数。该模块的核心是低功耗、低成本的 6 轴运动跟踪芯片 MPU6050,它将 3 轴陀螺仪、3 轴加速度计和数字运动处理器 (DMP) 集成到一个 4mm x 4mm 的微型芯片中。小时候,科学博览会上的陀螺仪总是让我们感到惊讶,因为它们以奇怪的方式移动,甚至似乎违背了重力。

sxstj的博客 9944

用AI+Playwright实现零代码UI自动化测试:以登录页面为例的实战指南

本文详细介绍了如何利用AI与Playwright结合实现零代码UI自动化测试,特别以登录页面为例进行实战演示。通过自然语言描述生成测试脚本,大幅降低技术门槛,提升测试效率,并支持跨浏览器验证。适合非技术人员快速上手专业级自动化测试。

weixin_28842269的博客 411

Android push原理

一、消息推送定义 在用户未打开App时,App主动向用户推送服务器最新消息。如下图: 二、App从服务器获取最新消息有两种基本方式 1、主动获取方式(Pull) 客户端隔固定时间主动向服务器获取信息,看是否有更新的信息;若有更新信息,则发送到客户端 2、被动接受方式(Push) 当服务器有更新信息时主动发送到客户端 对比:Push方式比Pull方式更优越。因为采用Pull方式时客户端需要不停地去监测服务器的变化,更费客户端的资源(CPU资源、网络流量、系统电量) 三、解决方案 1、C2DM (1)、原理:

分享Android开发知识 2139

Python实现多元线性回归(Multiple Linear Regression)

多元线性回归是一种用于建立多个自变量与因变量之间关系的统计学方法。在多元线性回归中,我们可以通过多个自变量来预测一个因变量的值。每个自变量对因变量的影响可以用回归系数来表示。

CSDN 精品推荐 4338

(转)Android C2DM学习——云端推送

一.基础知识 当我们开发需要和服务器交互的应用程序时,基本上都需要获取服务器端的数据,比如《地震及时通》就需要及时获取服务器上最新的地震信息。要获取服务器上不定时更新的信息一般来说有两种方法,第一种是客户端使用Pull(拉)的方式,隔一段时间就去服务器上获取信息,看是否有更新的信息出现。第二种就是服务器使用Push(推送)的方式,当服务器端有新信息了,则把最新的信息Push到客户...

dingtan9103的博客 197

beegfs读取文件完整流程分析

读取小于512KB文件数据,小于1s 读取15MB文件数据,花费7秒。

wfzy的博客 841

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

[原创]通过代码及流程图说明Google在Android上的Push机制的实现

[color=red][b]声明: 如果您要转载, 请事先征得本人的同意后方可并且请您附上原文链接. 本人保留一切权利. 多谢![/b][/color] Google从FroYo版本后引入了C2DM (Cloud to Device Messaging)框架: [url]http://code.google.com/android/c2dm/index.html[/url] [i]And...

坚持,淡定 322

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Android上GTalk以及Push机制的XMPP数据选择使用protobuf格式而非XML格式

<br />http://www.javaeye.com/topic/903179<br /> <br /> <br /> <br />http://code.google.com/p/protobuf/ <br /><br />先介绍下什么是protobuf以及有什么好处. <br />Protocol Buffers are a way of encoding structured data in an efficient yet extensible format. Google uses Proto

zhjp4295216的专栏 1930

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

Android推送通知指南及C2DM机制介绍

在开发Android和iPhone应用程序时,我们往往需要从服务器不定的向手机客户端即时推送各种通知消息。 消息通知 解决方法有两种: 1 轮询(Poll) 应用程序应当阶段性的与服务器进行连接并查询是否有新的消息到达,你必须自己实现与服务器之间的通信,例如消息排队等。而且你还要考虑轮询的频率,如果太慢可能导致某些消息的延迟,如果太快,则会大量消耗网络带宽和电池。 然而,每5分...

weixin_30624825的博客 122

C2DM

简介   Android Cloud to Device Messaging (C2DM) 作为 Android 2.2 的一部分已经发布了。C2DM 允许第三方开发者开发相关的应用来推送少量数据消息(1024bytes)到用户的手机上。C2DM 创造了一个良好的机会,允许我们使用多种 Google 开发工具来创建一种简单但相当实用的应用类型。用户可以使用该类型的应用把各种各样的信息从他们...

biandroid的专栏 195

Android推送技术总结

Android推送技术总结Android平台接入推送机制一般有两种,一种是Google官方提供的C2DM云端推送方案;另外一种是第三方,如极光、个推和友盟等推送平台。C2DM云端推送方案1)简单介绍在Android手机平台上,Google提供了C2DM(Cloudto Device Messaging)服务。Android Cloud to Device Messaging (C2DM) 作为 A...

lsxf_xin的专栏 1万+

Android Push Notification技术实现

在开发Android和iPhone应用程序时,我们往往需要从服务器不定的向手机客户端即时推送各种通知消息,iPhone上已经有了比较简单的和完美的推送通知解决方案,可是Android平台上实现起来却相对比较麻烦,最近利用几天的时间对Android的推送通知服务进行初步的研究。 在Android手机平台上,Google提供了C2DM(Cloudto Device Messaging)服务,起初

飞翔的熊blabla 470

Android实现推送方式解决方案 - 长连接+心跳机制(MQTT协议)

转载地址:http://www.cnblogs.com/hanyonglu/archive/2012/03/04/2378971.html 谢谢。 Android实现推送方式解决方案   本文介绍在Android中实现推送方式的基础知识及相关解决方案。推送功能在手机开发中应用的场景是越来起来了,不说别的,就我们手机上的新闻客户端就时不j时的推送过来新的消息,很方便的阅读最新的新闻信

edwar12345r的专栏 1678

[原]Android上GTalk以及Push机制的XMPP数据选择使用protobuf格式而非XML格式

[url]http://code.google.com/p/protobuf/[/url] [b]先介绍下什么是protobuf以及有什么好处.[/b] [i]Protocol Buffers are a way of encoding structured data in an efficient yet extensible format. Google uses Protocol B...

坚持,淡定 207
上一篇: 最近研究libjingle的经验总结
下一篇: 移动Web App流行框架比较分析
offbye
offbye 领域专家: 操作系统技术领域 领域专家: 操作系统技术领域
博客等级 码龄24年 1309粉丝 252原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址