Android - How to cancel a messaging subscription in the future

In the docs, it says to cancel a subscription by using the subscription object itself thats returned when you original subscribe to a messaging channel. What about the case where you subscribe, but later want to unsubscribe in a different session? Where are we supposed to save this subscription object? It surely isn’t a supported primitive…

I don’t see any retrieve subscriptions method in the docs. Am I missing something?


Hi Allen,

the subscription object is destroyed itself after closing the session.
There is no such method in the api to unsubscribe in a different session.


Hi Stanislav,

So how are we supposed to implement a subscribe/unsubscribe feature with push notifications?

For example: An app that shows a list of restaurants. The user wants to subscribe for updates from that particular restaurant, so I register the device for channel “<restaruant_id>_channel”. Great that all makes sense. Now what if that user wants to unsubscribe? How would I address this scenario. Please tell me there’s something in place for this, because that seems like a pretty glaring omission from a push/messaging feature set…

With push notifications you “unsubscribe” by unregistering device.

With pub/sub, the subscription stops once the app is terminated.


As per the android doc:

You should be able to register for push globally, or for a specific channel. I assume this implies I can register for multiple channels, is this correct? So I would expect that a device can register for global pushes, and specific channels for push.

That being said, the android docs for unregistering:
make no mention of unregistering from channels.

Definitely seems like the doc is missing something or I might just be going crazy… maybe both?

Device registration can be done for multiple channels, however, you cannot “stop” registration for only some channels. The register/unregister operations are “symmetric” - you register once, you unregister also only once.