Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

Is there any way in ionic to listen to android custom broadcast message?

$
0
0

@tushar4ic wrote:

I have found one non-angular implementation here : https://www.npmjs.com/package/cordova-plugin-broadcaster, But that's not working.

Here is my code inside app.js's $ionicPlatform.ready function :

if (window.broadcaster) {
        window.broadcaster.addEventListener( "CUSTOM_EVENT_NAME_BROADCASTED_FROM_NATIVE_LAYER", function( e ) {
                console.log( "Event received! userInfo: " + JSON.stringify(e)  );
        });            
} else {
        console.log('windown.broadcaster not available');
}

It's not invoking the else block, and the registered callback-block is not called also.

Any pointer would be helpful.

Thanks
- Tushar

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>