Closed strixy closed 7 years ago
Thanks for the PR ! Yes it is probably not the most popular plugin but why not !
I think the plugin file is missing though ?..
Apologies. First timer here. So much for rookie luck!
I've added it in now.
Thanks for the updated code
I am reviewing and testing right now
I'll probably change the example so that it reflects the usual example type and I have to update the vue-cordova-demo
repository as well I'll let you know when it's done
Your code seems OK but I can't get the demo to work, could you please help me out ? I may have missed something...
Code is here : https://github.com/kartsims/vue-cordova-demo/tree/dbmeter-plugin
Here are the steps to make it work on your setup :
vue-cordova-demo
repodbmeter-plugin
branchnpm install
Now because I haven't published to NPM yet the plugin, best would be to remove rm -rf node_modules/vue-cordova
and run npm install kartsims/vue-cordova#dbmeter-plugin
Then try to build the app with npm run build
and test it on your favorite platform... In my setup I didn't have anything (the number 23 should be updated with the value of db, I'll remove the hard-coded value 23)
Thanks for your feedback, it is important that the demo is fully working, that really helps newcomers
Quick note on my lunch break... I'm using Android, and haven't tested it in iOS. Totally opposite of your workflow. Everything works in Android. Are you able to access DBMeter in the global scope? I'll get the demo setup tonight after work and debug/test this as well as all the other plugins in Android so you can remove the warning about 'not testing in Android' while I'm at it. 2 birds, one stone.
Are you building with Swift 3? That might be part of the issue. The dbmeter plugin doesn't yet support swift 3.
https://github.com/akofman/cordova-plugin-dbmeter#installation
The iOS part is written in Swift so the Swift support plugin is configured as a dependency in plugin.xml.
:warning: Because this plugin doesn't support Swift 3 at the moment, the following preference has to be added in your project :
<preference name="UseLegacySwiftLanguageVersion" value="true" />
Yes I have added this tag to config.xml
but I forgot to re-prepare the ios platform (rm -rf platforms/ios
and cordove prepare ios
)
Now that it is done, I can't build the demo app... I get this error :
** BUILD FAILED **
The following build commands failed:
CompileSwift normal i386 /Users/simon/dev/vue-cordova-demo/platforms/ios/VueCordovaDemo/Plugins/cordova-plugin-dbmeter/DBMeter.swift
CompileSwiftSources normal i386 com.apple.xcode.tools.swift.compiler
(2 failures)
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/simon/dev/vue-cordova-demo/platforms/ios/cordova/build-debug.xcconfig,-project,VueCordovaDemo.xcodeproj,-target,VueCordovaDemo,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS Simulator,build,CONFIGURATION_BUILD_DIR=/Users/simon/dev/vue-cordova-demo/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/simon/dev/vue-cordova-demo/platforms/ios/build/sharedpch
I am investigating it
Could you provide me your config.xml
file ? That might help me debug better
I tried adding <preference name="UseLegacySwiftLanguageVersion" value="true" />
both in the root tag <widget>
or in the <platform name="ios">
. Didn't change a thing
OK it is working now, for some reason I had to remove the plugins/
folder and run cordova prepare
again... I don't really understand why but it is OK now
I still have a problem with displaying the data, I'll let you know when it's ready
I can't help with the iOS part, but for showing data try getting at the DBMeter in the global scope first. See if this works.
Example:
<template>
<div>
<div id="level">{{ meterLevel }}dB</div>
</div>
<template>
export default {
data () {
return {
meterLevel: 40
};
},
mounted () {
if("DBMeter" in window){
DBMeter.start(function(dB){
this.$set(this, 'meterLevel', ave);
}.bind(this));
}
}
};
Hey @kartsims where are we on this PR? What do I need to do to get this closed?
I can't get the demo working and I don't know why...
https://github.com/kartsims/vue-cordova-demo/tree/dbmeter-plugin
I won't merge this until demo is working, users really like to have a fully working demo.
@strixy want to get this merged or should I close it ?
It's an interesting little effect that uses the microphone to calculate the ambient noise levels. Let me know if this is acceptable.