Problem with OneSignal

After migrate to Ionic Pro, I’m trying to configure a new method to send push notification. I can register the devices and send notification with OneSignal, but I’m can’t get PlayerId or send tags.

This is my code:

    this.oneSignal.startInit('xxxxxx', 'xxxxxx');


    this.oneSignal.handleNotificationReceived().subscribe(() => {
      console.log('push received')

    this.oneSignal.handleNotificationOpened().subscribe(() => {
      console.log('push opened')

    this.oneSignal.sendTag('device_uuid', this.device.uuid);

    .then((id) => {


Am I doing something wrong? If not, what is the best alternative to do this (maybe another plugin)?

Thank you

How exactly is this related to Ionic Pro?
Or was this only the trigger for you switching to OneSignal?

Exactly, this was only the trigger.

1 Like

What exactly is this? Ionic Native plugin?

What is this PlayerId you talk about? Doesn’t appear in the code.

This plugin:

PlayerId is an user unique identifier attached by OneSignal, I think that I should get this with getIds() function.

Anyway, I’m tried to set custom tags with sendTag() function but this doesn’t work too.

I could fix the category now :wink:

Are you sure the Id and Tag functions should be called inside the “init” flow? (Have no personal experience with OneSignal)
Does this.oneSignal.getIds return anything or error out?

I have no sure. I can’t found good explanations about this.

No errors, just can’t see the console result.

Do you have some alternative to OneSignal that you’ve experienced?

Looking at the SDK docs directly I think this should happen “outside” the init somewhere:

1 Like

You’re right. Putting the getIds() function after endInit() works perfectly.

Thank you @Sujan12