Need help upgrading to Ionic Framework 4.0? Get assistance with our Enterprise Migration Services EXPLORE NOW

DB Meter

Improve this doc

This plugin defines a global DBMeter object, which permits to get the decibel values from the microphone.

Repo: https://github.com/akofman/cordova-plugin-dbmeter

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cordova-plugin-dbmeter
    $ npm install --save @ionic-native/db-meter@4
    
  2. Add this plugin to your app's module

Supported platforms

Usage

import { DBMeter } from '@ionic-native/db-meter';

constructor(private dbMeter: DBMeter) { }

...


// Start listening
let subscription = this.dbMeter.start().subscribe(
  data => console.log(data)
);

// Check if we are listening
this.dbMeter.isListening().then(
  isListening => console.log(isListening)
);

// Stop listening
subscription.unsubscribe();

// Delete DBMeter instance from memory
this.dbMeter.delete().then(
  () => console.log('Deleted DB Meter instance'),
  error => console.log('Error occurred while deleting DB Meter instance')
);

Instance Members

start()

Starts listening

Returns: Observable<any> Returns an observable. Subscribe to start listening. Unsubscribe to stop listening.

isListening()

Check if the DB Meter is listening

Returns: Promise<boolean> Returns a promise that resolves with a boolean that tells us whether the DB meter is listening

delete()

Delete the DB Meter instance

Returns: Promise<any> Returns a promise that will resolve if the instance has been deleted, and rejects if errors occur.

API

Native

General