Getting this error while importing package
Type 'SmsRetrieverOriginal' is not assignable to type 'Provider'.
Type 'SmsRetrieverOriginal' is missing the following properties from type 'FactoryProvider': provide, useFactoryts(2322)
Getting this error while importing package
Type 'SmsRetrieverOriginal' is not assignable to type 'Provider'.
Type 'SmsRetrieverOriginal' is missing the following properties from type 'FactoryProvider': provide, useFactoryts(2322)
How are you importing it? Show some more code
In app.module.ts
import { SmsRetriever } from '@ionic-native/sms-retriever/ngx';
then in the providers array I’m adding this SmsRetriever
Hi, did anyone solve this? I’m getting the same error
Hi, there’s another way to use this plugin.
Just make sure that you install this plugin from npm and also you’re able to see the plugin name in the plugins folder.
Then try this code below.
getHashCode() {
console.log(this.countryCode, this.mobileNumber);
if (this.platform.ready()) {
const smsRetriever: any = window.cordova.plugins.smsRetriever;
smsRetriever['getAppHash']((res) => {
this.appHashString = res;
this.cd.detectChanges();
console.log(res);
}, (err) => {
console.warn(err);
});
}
}
getSMS() {
if (this.platform.ready()) {
const smsRetriever: any = window.cordova.plugins.smsRetriever;
smsRetriever['startWatching']((res) => {
this.smsTextmessage = res.Message;
console.log(res);
this.smsTextmessage = res.Message.toString().substr(4, 6);
this.cd.detectChanges();
}, (err) => {
console.warn(err);
});
}
}