Skip to main content
Version: v5

Broadcaster

This plugin adds exchanging events between native code and your app.

https://github.com/bsorrentino/cordova-broadcaster

Stuck on a Cordova issue?

Don't waste precious time on plugin issues.

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic’s experts offer premium advisory services for both community plugins and premier plugins.

Installation

$ npm install cordova-plugin-broadcaster 
$ npm install @awesome-cordova-plugins/broadcaster
$ ionic cap sync

Supported Platforms

  • Android
  • iOS
  • Browser

Usage

React

Learn more about using Ionic Native components in React

Angular

import { Broadcaster } from '@awesome-cordova-plugins/broadcaster/ngx';

constructor(private broadcaster: Broadcaster) { }

...

// Listen to events from Native
this.broadcaster.addEventListener('eventName').subscribe((event) => console.log(event));

// Send event to Native
this.broadcaster.fireNativeEvent('eventName', {}).then(() => console.log('success'));