Firebase Push Notification Topic Subscription

I have the following code for push notifications using ionic cloud and Firebase Cloud Messaging.

let topic = "topics/" + this.user.userRole + "/" + this.user.location;
                    console.log("TOPIC: ", topic);
                    const options:PushOptions = {
                        android: {
                            senderID: "xxxxx",
                            sound: true,
                            vibrate: true,
                            //topics: [topic]
                        ios: {
                            alert: "true",
                            badge: false,
                            sound: "true"
                        windows: {}

It works, but as soon as I try to subscribe to a specific topic, then the app crashes when running from android.

When I use subscribe, in the manner below:

pushObject.on('registration').subscribe((data:any) => {
                        console.log("device registered -> ", data);
                        let topic = "topics/" + this.user.userRole + "/" + this.user.location;
                        pushObject.subscribe(topic).then((res:any) => {
                            console.log("subscribed to topic: ", res);

Again, nothing happens and I’m not receiving any information showing I was able ot subscribe to a topic.

How do I accomplish topic subscription?

Where does this come from? What is the library behind it? (Provide a link please)

This is an ionic 3 package.

So I have this in my package.json

"@ionic-native/push": "3.4.4"

I then import it into my app.component:

import { Push, PushObject, PushOptions } from '@ionic-native/push';

and finally create an object:

const pushObject:PushObject = this.push.init(options);

Here is the link.

There is no documentation for this at Are you sure that is correct?

i’m getting this same error

any news about this issue?

There is an open question from me posted above. If you have the exact same problem, maybe you can answer it?

Ok actually I had not the issue, I just followed the documentation of the cordova plugin here: and it works correctly. So I’m not getting any error.

the code is correct. i just tried it.

he posted on stackoverflow too and found the solution himself. He used special characters in the topic name.
So if you have the same problem, check the topic name. the code works.

PushObject has the function subscribe(topic) that return a promise.