我可以在我的应用程序接收GCM的消息从两个或多个GCM SENDER_ID?我的、多个、应用程序、两个

2023-09-06 23:40:39 作者:涐扪の噯纞

我要接收来自不同的发送者推送通知我的应用程序。将它的工作?

I need to receive push notifications from different senders in my app. Will it work?

推荐答案

回答你的问题的是的!

据GCM的官方文档的应用程序可以接收来自多个发件人的邮件(仅限于100种不同的发送者)和你的意图code应该像上面的一个正常工作。

According to GCM's official documentation your app can receive messages from multiple senders (limited to 100 different senders) and your intent code should look like the above one to work correctly.

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页面官方主题。