0
votes

I am using “open-native-settings” on my ionic 4 project. Based on the documentation https://ionicframework.com/docs/native/open-native-settings#usage My implementation as bellow.

myclass.module.ts:

import { OpenNativeSettings } from '@ionic-native/open-native-settings/ngx';


providers:[
    OpenNativeSettings
  ],

myclass.ts file:

import { OpenNativeSettings } from '@ionic-native/open-native-settings/ngx';
import { Platform } from 'ionic-angular';

constructor(
    private openNativeSettings: OpenNativeSettings,
    private _platform: Platform) {}

inside a method

this._platform.ready().then(() => {
          // open settings
          this.openNativeSettings.open("about").then(val => {
            console.log('success')
          });

        });

I don't get any compilation errors. But when I call the method, app shows below runtime error.

enter image description here

any suggestions?? Thanks

1
Your should add this in your app.module.ts as well. - Najam Us Saqib
@NajamusSaqib Thanks for the suggestion. But I managed to resolve the issue by downgrading plugin version as bellow answer - smartsanja

1 Answers

1
votes

Found the issue in my case. Since I am using ionic v4.x, I downgraded open-native-settings plugin version to 4.x

npm install @ionic-native/open-native-settings@4

Then import without /ngx. All other codes as same as above

import { OpenNativeSettings } from '@ionic-native/open-native-settings';