
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
community-cordova-plugin-dbmeter
Advanced tools
This plugin defines a global DBMeter object, which permits to get the decibel values from the microphone. Although the object is in the global scope, it is not available until after the deviceready event.
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
DBMeter.start(function(dB){
console.log(dB);
});
}
cordova plugin add cordova-plugin-add-swift-support
cordova plugin add community-cordova-plugin-dbmeter
The iOS part is written in Swift so the Swift support plugin is needed.
Since iOS 10 it's mandatory to provide an usage description in the info.plist if trying to access privacy-sensitive data. When the system prompts the user to allow access, this usage description string will displayed as part of the permission dialog box, but if you didn't provide the usage description, the app will crash before showing the dialog. Also, Apple will reject apps that access private data but don't provide an usage description.
This plugins requires the following usage description:
To add this entry into the info.plist, you can use the edit-config
tag in the platform section of your config.xml
like this:
<edit-config target="NSMicrophoneUsageDescription" file="*-Info.plist" mode="merge">
<string>need microphone access to record sounds</string>
</edit-config>
DBMeter.start(success, error)
start listening.
DBMeter.start(function(dB){
console.log(dB);
}, function(e){
console.log('code: ' + e.code + ', message: ' + e.message);
});
DBMeter.stop(success, error)
stop listening.
DBMeter.stop(function(){
console.log("DBMeter well stopped");
}, function(e){
console.log('code: ' + e.code + ', message: ' + e.message);
});
:warning: If the DBMeter is stopped while is not listening, an error will be triggered and can be handle from the second callback argument.
DBMeter.isListening(success, error)
retrieve from the success callback whether the DBMeter is listening.
DBMeter.isListening(function(isListening){
console.log(isListening);
});
DBMeter.delete(success, error)
delete the DBMeter instance.
DBMeter.delete(function(){
console.log("Well done !");
}, function(e){
console.log('code: ' + e.code + ', message: ' + e.message);
});
:warning: If the DBMeter has not been started once before deleting, an error will be triggered and can be handle from the second callback argument.
An app is available in the app folder and is generated from the Cordova Plugin Test Framework. It permits to launch auto tests and manual tests.
To install it, please follow these steps :
cd app && cordova platform add android|ios
cordova run android|ios --device
FAQs
Cordova DBMeter plugin
The npm package community-cordova-plugin-dbmeter receives a total of 1 weekly downloads. As such, community-cordova-plugin-dbmeter popularity was classified as not popular.
We found that community-cordova-plugin-dbmeter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.