Documentation

Subscribe to Topics (Optional)


Optionally subscribe the device to one or more topics to target multiple devices with a shared interest when sending notifications.

Depending on your app's notification criteria, you may be able to leverage topics to simply the process of sending the same notification to multiple devices. If your app only sends personalized notifications, skip this step and simply target individual devices by specifying their tokens.


Simply add the following blocking code to subscribe a registered device to a topic:

Pushy.subscribe("news", getApplicationContext());

Note: Make sure to execute this method from a background thread, similar to Pushy.register(Context).

Also, replace news with your own case-sensitive topic name that matches the following regular expression: [a-zA-Z0-9-_.]+. You may also pass in a String[] array with multiple topics.


You can then notify devices subscribed to a certain topic by specifying the topic name (prefixed with /topics/) as the to parameter in the Send Notifications API.