Ionic 4 - Ionic wrapper for custom plugins Error: Object(...) is not a function

I built a plugin then i create his wrapper for work with typescript, this code works on ionic 3 but i have this error on ionic 4

this is my ionic native wrapper for my custom plugin

  1. file-path: src/@ionic-native/plugins/signal-strenght/index.ts
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';

    pluginName: 'SignalStrength',
    plugin: 'cordova-aspolar-plugin-signal-strength',
    pluginRef: 'window.plugins.signalStrength',
    repo: '',
    platforms: ['Android']
export class SignalStrength extends IonicNativePlugin {

    getdBm(): Promise<any> { return; }

    getPercentage(): Promise<any> { return; }

    getLevel(): Promise<any> { return; }

  1. on app.module.ts

  2. I get this error

Hi @AsPolar :wave:

For Ionic 4 you need to use Ionic Native 5 and add /ngx at the end of the path for all @ionic-native imports.



thanks romero. but this is a cordova custom plugin it hasn’t a typescript file on @ionic-native that’s why i need build a wrapper for that plugin.

Sorry, I misread your message and didn’t notice this is a custom plugin :sweat_smile:

1 Like

Try to write the provider similar to the compiled Ionic Native code

import { Injectable } from '@angular/core';
import { cordova, IonicNativePlugin } from '@ionic-native/core';

export class SignalStrength extends IonicNativePlugin {
    static pluginName = 'SignalStrength',
    static plugin = 'cordova-aspolar-plugin-signal-strength',
    static pluginRef = 'window.plugins.signalStrength',
    static repo = '',
    static platforms = ['Android']

    getdBm(): Promise<any> { 
       return cordova(this, 'getdBm', {}, []};


did you find the solution? I am faced with the same problem :confused:

1 Like

@goku-dev, I solved this building ts how an interface and a js. but that was before @jean-pierre-ilofo-sy answered this post (I invite you to try it his aswered)

Hi!!, can you share the solution pls :frowning: because I tried @jean-pierre-ilofo-sy solution but it returns “invalid action”

1 Like

I need too :grinning:

Hi Did you get solution for this ?
if you get the solution ,please share here .
thanks in advance

Hi, I am also looking for solution how to use custom cordova plugin from ionic react app using ionic 4?

I’m going to start using Capacitor, because it’s too easy to create plugins with it. In addition it is plug and play with ionic 4.

did anyone found the solution, as I am getting the same error