infil00p / cordova-crosswalk-engine

(UNMAINTAINED) Proof of Concept Third Party Web Engine using Crosswalk
Apache License 2.0
46 stars 440 forks source link

OneSignal doesnt work when using crosswalk?? #65

Open asamuga opened 7 years ago

asamuga commented 7 years ago

So I have this code in my app.component.ts

constructor(platform: Platform,
              public authservice: AuthService,
              public menu: MenuController,
              public events: Events,
              public user: UserData ) {
    platform.ready().then(() => {

      OneSignal.startInit('hidden', 'hidden');
      OneSignal.inFocusDisplaying(OneSignal.OSInFocusDisplayOption.InAppAlert);
      OneSignal.handleNotificationReceived().subscribe((data) => {
        data.payload.rawPayload = JSON.parse(data.payload.rawPayload);
        this.user.sendNotificationToServer(data);
      });
      OneSignal.handleNotificationOpened().subscribe((data) => {
        data.payload.rawPayload = JSON.parse(data.payload.rawPayload);
        console.log(data);
      });
      OneSignal.endInit();

      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      StatusBar.styleDefault();
      Splashscreen.hide();
    });
  }

and this worked, but when I installed crosswalk, functions "handleNotificationReceived" or "handleNotificationOpened" dont get called at all.

I receive push notificaiton in my status bar, but this code is not executed.

I also get this warning in Console Native: deviceready did not fire within 2000ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.

So I ran ionic state reset but still nothing.

Any idea why is this happening?

fujunwei commented 7 years ago

Could you please file a bug in JIRA https://crosswalk-project.org/jira? We will verify it.

asamuga commented 7 years ago

You can refer here for more details, but the conclusion is that OneSignal and Crosswalk dont work together when use in Ionic 2 and TS.

https://forum.ionicframework.com/t/onesignal-doesnt-work-when-using-crosswalk/69440