Closed ShivamPokhriyal closed 5 years ago
HI @ShivamPokhriyal
The follow code isn't correct
this.broadcaster = new Broadcaster();
this.broadcaster.addEventListener("callback").subscribe((event) => { // you can subscribe for multiple events from native
console.log("received event : ");
});
try code below instead
window.broadcaster.addEventListener("callback").subscribe((event) => { // you can subscribe for multiple events from native
console.log("received event : ");
});
@bsorrentino I am using typescript and that code worked perfectly well in case of android. I made it work for iOS too, I did find one interesting thing though, it was not working when i had this code in constructor, but when i put that in one of the methods, it worked.
You can close this thread. Thankyou.
Hi @ShivamPokhriyal thanks for feedback.
Probably the constructor run before cordova stuff has been setup
I have to send broadcast from iOS. I used following code which is not working.
I even checked if something was wrong with the broadcast by listening to it in native side only and it was working perfectly fine there.
The same is working fine when i am sending broadcasts from android side using following code: