Can I receive GCM messages from two or more GCM SENDER_ID in my application?

I need to receive push notifications from different senders in my application. Will this work?

+4
source share
2 answers

The answer to your question: YES!

According to the official GCM documentation, your application can receive messages from several senders (limited to 100 different senders), and your intent code should look like the one shown above.

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);

Remember to check the official topic on the GCM page of several senders .

+6
source

api , . API, Google ( ) .

0

All Articles