Broadcaster

Contents

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

Installation

ionic cordova plugin add cordova-plugin-broadcasternpm install @ionic-native/broadcaster
Ionic EE comes with fully supported and maintained plugins from the Ionic Team. Learn More or Contact Us
ionic enterprise register --key=YOURPRODUCTKEYnpm install @ionic-enterprise/broadcaster

Supported Platforms

  • Android
  • iOS
  • Browser

Usage

import { Broadcaster } from '@ionic-native/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'));