akofman / cordova-plugin-dbmeter

:microphone::mega: Cordova plugin to get decibels from the microphone
Apache License 2.0
35 stars 29 forks source link

cordova-plugin-dbmeter no provider for DBMeter #3

Closed albernaz closed 6 years ago

albernaz commented 7 years ago

cordova-plugin-dbmeter no provider in Ionic 2 Application

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

constructor(public platform: Platform, public dbMeter: DBMeter) {}

and in class ...

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

Gives this error!

Runtime Error
Error in ./MyApp class MyApp - inline template:19:0 caused by: No provider for DBMeter!
Stack
Error: No provider for DBMeter!
    at NoProviderError.BaseError [as constructor] (http://localhost:8100/build/main.js:8347:34)
    at NoProviderError.AbstractProviderError [as constructor] (http://localhost:8100/build/main.js:52946:16)
    at new NoProviderError (http://localhost:8100/build/main.js:52977:16)
    at ReflectiveInjector_._throwOrNull (http://localhost:8100/build/main.js:98815:19)
    at ReflectiveInjector_._getByKeyDefault (http://localhost:8100/build/main.js:98843:25)
    at ReflectiveInjector_._getByKey (http://localhost:8100/build/main.js:98806:25)
    at ReflectiveInjector_.get (http://localhost:8100/build/main.js:98615:21)
    at AppModuleInjector.NgModuleInjector.get (http://localhost:8100/build/main.js:53648:52)
    at CompiledTemplate.proxyViewClass.AppView.injectorGet (http://localhost:8100/build/main.js:99357:45)
    at CompiledTemplate.proxyViewClass.DebugAppView.injectorGet (http://localhost:8100/build/main.js:99599:49)
Ionic Framework: 2.1.0
Ionic Native: 2.4.1
Ionic App Scripts: 1.1.3
Angular Core: 2.2.1
Angular Compiler CLI: 2.2.1
Node: 7.2.1
OS Platform: Windows 8.1
Navigator Platform: Win32
User Agent: Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Mobile Safari/537.36

Any solutions on this? I´m missing something ?

Thankx a lot

akofman commented 6 years ago

It sounds more like an Ionic issue. I'm sorry but I'm not familiar with the notion of Angular/Ionic provider. I think you should check your framework configuration or ask this to an Ionic expert.