DB Meter
$ ionic plugin add cordova-plugin-dbmeter
Repo: https://github.com/akofman/cordova-plugin-dbmeter
This plugin defines a global DBMeter object, which permits to get the decibel values from the microphone.
Supported platforms
- iOS
- Android
Usage
import {DBMeter} from 'ionic-native';
// Start listening
let subscription = DBMeter.start().subscribe(
data => console.log(data)
);
// Check if we are listening
DBMeter.isListening().then(
(isListening : boolean) => console.log(isListening)
);
// Stop listening
subscription.unsubscribe();
// Delete DBMeter instance from memory
DBMeter.delete().then(
() => console.log("Deleted DB Meter instance"),
error => console.log("Error occurred while deleting DB Meter instance")
);
Static Methods
start()
Starts listening
Returns:
Observable<string>
Returns an observable. Subscribe to start listening. Unsubscribe to stop listening.
stop()
Stops 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.