IONIC 3: 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:

“Object(…) is not a function”

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

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

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) { }

Please I need to run this plugin in my project


I have answered a similar question here

Check your project type in ionic.config.json file.

If the type is “ionic-angular”, then install 4.x.x version.

npm i -s @ionic-native/[email protected]

If the type is “angular”, then install 5.x.x-beta version

npm i -s @ionic-native/[email protected]


Add ngx at the end of import only if you are using Angular 6

import { BackgroundMode } from '@ionic-native/background-mode/ngx';

if not remove ngx from the import both in app.module.ts and app.component.ts

import { BackgroundMode } from '@ionic-native/background-mode';

Answered By – Rathnakara S

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published