OneSignal doesnt work when using crosswalk?

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?

Your above syntax isn’t correct, it should be as follows:
Your syntax is correct however we indented initialization to be formatted like this:

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

Make sure to use onesignal-cordova-plugin instead of the compat version with Ionic.

The reason why I used the code above is because it says so here: http://ionicframework.com/docs/v2/native/onesignal/

I’ve just copied code from the documentation and like I said, it worked, until I installed crosswalk plugin.

Anyway, when I use your code I get this error: The number of expected arguments is 0.

Sorry, there was a error in the code I pasted above and have corrected it in my answer.

I see have crosswalk create compile issues since it include’s its own copy of the Android Support Library v4 however I haven’t seen any run-time issues. Are you seeing an issue with iOS or Android. What version of crosswalk, Cordova, and Ionic are you using?

The error deviceready did not fire within 2000ms can happen when there is a syntax or run-time error in javascript. Do you get any other errors before this one?

Are you able to reproduce the issue a new project? If so can you share the project on the github or share the project as a zip?

Now your code is KIND OF working. Now notifications arrive to my phone and they are visible in the status bar, but they ARE NOT visible inside an app and there is no alert popup. Also functions like handleNotificationReceived or handleNotificationOpened DO NOT execute when notifications arrive. Also OneSignal.syncHashedEmail DOES NOT work. This is all when using crosswalk.

So I did what you told me to. I installed new fresh Ionic app and then installed OneSignal plugin. Tested notifications and they work perfectly.

Then I installed crosswalk and tried again. It still doesnt work. I receive notifications in status bar, but they are not visible inside app neither functions handleNotificationReceived , handleNotificationOpened execute. And also syncHashedEmail doesnt work when called.

I guess this proves it is not my fault or any potential errors in my code. You can try to do what I did. Fresh ionic app and onesignal and crosswalk plugins.

It seems like there is an issue with either Crosswalk or OneSignal. I mean, OneSignal works when crosswalk is not used. I’m not sure what is going on.

Also my ionic info:

Thanks for the details. Did you get he warning in your first post from the logcat or with Chrome remote debugging? Can you try Chrome remote debugging to see if you get any additional javascript errors?

You may have to press refresh on your system in Chrome after you connect.

The warning I mentioned in the first post is from Remote debugging Chrrome Console.

On the fresh app it disappeared.

But again that’s not the point, because OneSignal is still not working with crosswalk.

We haven’t received any other reports of a run time issue like this with crosswalk. No errors or warning in the logcat? Could you attach a project as a github repo or zip so we can reproduce the issue?