Pushwoosh / pushwoosh-react-native-plugin

Other
58 stars 44 forks source link

Android: register/unregister callbacks never triggered #27

Closed nicholasc closed 6 years ago

nicholasc commented 6 years ago

The init function work well. My success callback is trigged but then when I try to register or unregister a device:

Pushwoosh.register(
  token => {
    console.log("Pushwoosh register success", token);
    this.token = token;
  },
  e => console.log("Pushwoosh register failed", e)
);

neither callbacks (success or failure) are triggered.

Based on the source code of the plugin:

if (result.isSuccess()) {
  success.invoke(result.getData());
} else if (result.getException() != null) {
  error.invoke(result.getException().getLocalizedMessage());
}

So it seems in my case that result.isSuccess() is false and that result.getException() is equal to null.

Any idea how that is possible?

wfhm commented 6 years ago

@nicholasc

Checking it.

nicholasc commented 6 years ago

Any update on this?

wfhm commented 6 years ago

@nicholasc Got it reproduced and put a task to fix it in our pipeline. Will be fixed with the next releases.

nicholasc commented 6 years ago

Any ETA on that release? Eager to get notifications on Android.

wfhm commented 6 years ago

@nicholasc We are expecting to roll out a new version of the plugin by the end of this week, however this issue will not be resolved in it, so I cannot provide any particular ETA right now.

Also, in my tests I have reproduced the issue with callbacks not firing, however registration was successful and I could receive pushes on a device. May I ask you to provide us with a reproducer APK so we could try it on our side? If it is by any chance possible, please send it to help@pushwoosh.com with a link to this thread.

wfhm commented 6 years ago

@nicholasc

Have just tried reproducing the issue with 5.7.0 version and it works perfectly. Therefore we would need a reproducer (ideally build with the latest plugin version) so we could proceed with the investigation.

wfhm commented 6 years ago

@nicholasc By any chance is there a possibility to provide us with a reproducer apk/project?

nicholasc commented 6 years ago

I wish I could but this is happening in a close-to-production app and I can't release the source. I am ready to do some of the debugging you had in mind if that's an option.

Also, I am using the latest 5.8.0 and I am still experiencing the issue.

nicholasc commented 6 years ago

It is definitely linked to #28 as I have empty results when using getHwid. I also used a proxy to monitor the api requests in the register & unregister calls. To my surprise, the requests never actually get sent to the pushwoosh service on Android but iOS yes.

nicholasc commented 6 years ago

I have deactivated all plugins in the project. Isolated the application so it only tries to register pushwoosh and nothing else and I still have the issue. I am thinking that the android project configuration is causing this issues. I am going to try and create a repository with the broken android project configuration so you can test it out.

nicholasc commented 6 years ago

I was able to create a reproducer project after all. https://github.com/nicholasc/pushwoosh-android-broken

wfhm commented 6 years ago

@nicholasc Great, thank you! Checking it now.

nicholasc commented 6 years ago

Amazing, let me know what you find. I'll keep looking on my end.

wfhm commented 6 years ago

@nicholasc I've managed to create a very similar working project, please have a look:

https://github.com/wfhm/PW-react-native-sample-for-nicholasc

Strangely, there were no significant changes, so I am still not sure what is happening in your app, however may I ask you to try this one and let me know about the results?

nicholasc commented 6 years ago

Finally found it....

Removing tools:node="replace" from the application tag inside the AndroidManifest.xml file fixed it.

Apparently, merging the manifests causes a problem somewhere. I think this should be documented.

wfhm commented 6 years ago

@nicholasc Great news! We will check what happens when adding tools:node="replace" in a bit more details and surely add it to our documentation.