smartsanja
smartsanja

Reputation: 4550

Ionic 4 Open Native Settings Plugin not working

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

Upvotes: 0

Views: 3111

Answers (1)

smartsanja
smartsanja

Reputation: 4550

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';

Upvotes: 1

Related Questions