Ionic Onesignal getIds pushToken always null


#1

Hello everyone.
I have an app with push notification using onesignal. When I registered the player ID with method getIds it’s always null for pushToken value see in a picture below (in this case i’am using xiaomi with rom china). But, if i use another device it’s not problem. Is there any issue with rom china in this case.

Here’s the code for get player ID with one signal :

constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, public oneSignal: OneSignal) {
    platform.ready().then((res) => {
      if(res == 'cordova') {
        this.oneSignal.startInit(Env.APP_ID_OS, Env.GOOGLE_PROJECT_ID);
        this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.Notification);
        this.oneSignal.setSubscription(true);
        this.oneSignal.handleNotificationReceived().subscribe(() => {
          console.log('Received Notification');
        });
        this.oneSignal.handleNotificationOpened().subscribe(() => {
          console.log('Opened Notification');
        });
        this.oneSignal.endInit();
        this.oneSignal.getIds().then(data => {
          alert(JSON.stringify(data));
        })
      }
      statusBar.styleDefault();
      splashScreen.hide();
    });
  }

Thanks everyone.


#2

Maybe there is an test app from one signal that you could try to find out if it’s the plugin or one signal in general that’s not working… :thinking:


#3

Does push work in any other app on this device?


#4

Thanks for reply. In another app, push work in this device.


#5

Thanks for reply. Nope, it’s not an test app. Event I updated at latest cordova one signal plugin, that still not work.