GCM - how to selectively send messages to certain package names?

326 views Asked by At

We have a project with three build variants: dev, tst, live and respective package names our.package.name.dev, our.package.name.tst, our.package.name. All build variants have different back-ends so we need to display different push notifications for different variants.

The Server API key in the developers console is not connected with any certain build variant/package name, so it sends out to all build flavours.

Is there a designated way to approach this problem? The only solution I currently see, is to send the target build variant with the GCM data and check in the front-end.

1

There are 1 answers

0
gerardnimo On BEST ANSWER

You can use an option restricted_package_name. This parameter specifies the package name of the application where the registration tokens must match in order to receive the message.