android - 我可以在我的应用程序中接收来自两个或多个 GCM SENDER_ID 的 GCM 消息吗?

标签 android push google-cloud-messaging

我需要在我的应用程序中接收来自不同发件人的推送通知。会成功吗?

最佳答案

你的问题的答案是!

根据 GCM 的官方文档,您的应用可以接收来自多个发件人的消息(限制为 100 个不同的发件人),并且您的 intent 代码应该与上述代码类似才能正常工作。

Intent intent = new Intent(GCMConstants.INTENT_TO_GCM_REGISTRATION);
intent.setPackage(GSF_PACKAGE);
intent.putExtra(GCMConstants.EXTRA_APPLICATION_PENDING_INTENT,
        PendingIntent.getBroadcast(context, 0, new Intent(), 0));
String senderIds = "968350041068,652183961211";
intent.putExtra(GCMConstants.EXTRA_SENDER, senderIds);
ontext.startService(intent);

请随时查看 GCM 页面上关于 multiple senders 的官方主题.

关于android - 我可以在我的应用程序中接收来自两个或多个 GCM SENDER_ID 的 GCM 消息吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11858398/

相关文章:

git - 将主分支设置为最新标签

android - 如何通过 GCM 服务器将 XML 文件从服务器推送到 Android 应用程序

google-chrome-extension - GCM 通知示例中的 'app key' 是什么?

javascript - 使用 JavaScript 的实时博客系统

android - GCM 和 SIM 的变化

android - Google Cloud Messaging 是否会向处于待机模式的设备发送消息?

android - 集成 skyscanner api 以获取实时价格

android - 如何在 Robolectric 2.2 中指定 custom/res 目录?

android - 从 Spinner 获取键和值的最佳方式

android - Espresso : How to select element on webview using text