Plugin BackgroundMode dont work: Object(...) is not a function

I need to run the code “this.backgroundMode.enable()” in my project, but it shows me the following error:

08

It imports it in app.module.ts in the following way:

import {BackgroundMode} from '@ ionic-native / background-mode / ngx';
...
providers: [
...
BackgroundMode
...]

And in the page (in my case is in app.component.ts, after deviceready, like the official documentation says) i use like:

import {BackgroundMode} from '@ ionic-native / background-mode / ngx';
constructor(private backgroundMode: BackgroundMode) { }
...
this.backgroundMode.enable();

Please I need to run this plugin in my project, can you help me?

1 Like

Hello,
are there spaces in the path? ‘@ ionic-native / background-mode / ngx’

Late regards, anna-liebt

Hello @anna_liebt, there is no space in the path.

I following this StackOverlow link to solution my problem:

Thanks!