当注册推? [英] When register for push?

查看:89
本文介绍了当注册推?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是否需要该应用程序创建的每个时间注册了推?抑或是足以登录后注册一次,例如?什么是叫 C2DMessaging.register(getApplicationContext(),C2DMConstants.SENDER)的最佳点;

Do I need to register for push each time that the app is created? Or is it enough to register once, for example after login? What is the best point to call C2DMessaging.register(getApplicationContext(), C2DMConstants.SENDER); ?

推荐答案

没有。它没有必要每次都进行登记时,应用程序启动。但是,你必须检查你的注册ID是否被GCM服务器改变与否。因为有时候GCM需要改变注册ID,甚至不通知设备。所以,你必须保存您的注册ID在你的应用程序和应用程序启动,符合保存的ID和id由GCMRegistrar.getRegistrationId()方法返回。如果这两个是不同的,保存并同时更新您的服务器上。

No. Its not necessary to register every time when app started. But you have to check whether your registration id is changed by GCM server or not. Because sometimes GCM needs to change registration id and even it does not inform device. So you have to save your registration id in your app and on app start, match the saved id and id returned by GCMRegistrar.getRegistrationId() method. If both are different, save it and also update it on your server.

这篇关于当注册推?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆