0

I am trying to install background Mode in ionic.

ionic cordova plugin add cordova-plugin-background-mode
npm install --save @ionic-native/background-mode@4

Below is error

getting below warning ionic cordova plugin add cordova-plugin-background-mode $ npm install --save @ionic-native/background-mode@4

and when I use in Home.ts file it says as

pluginWarn @ vendor.js:52024 vendor.js:52018 Native: tried calling BackgroundMode.un, but the BackgroundMode plugin is not installed. pluginWarn @ vendor.js:52018 vendor.js:52024 Install the BackgroundMode plugin: 'ionic cordova plugin add cordova-plugin-background-mode' pluginWarn @ vendor.js:52024 vendor.js:1639 ERROR plugin_not_installed

can somebody suggest?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Swift
  • 829
  • 2
  • 12
  • 33

2 Answers2

0

I found solution. Check your cordova version

cordova -v

Now cordova version is 9.0.0 then problem will be there. Referece: https://forum.ionicframework.com/t/backgroundmode-not-installing-cordova-9/160226/4 Now globally uninstall cordova by following command

where cordova // windows users
which cordova //mac users

It will give full path of cordova Now, npm uninstall -g cordova It will remove cordova globally Now install specific version of cordova here, npm install -g cordova@8.0.0 It will install cordova version 8.0.0 and you can now able to install BackgroundMode plugin. Thank you and enjoy

Swift
  • 829
  • 2
  • 12
  • 33
0

Reverting from Cordova 9.0 back to Cordova 8.0 fixed the issue with background-mode plugin not installed.

npm uninstall -g cordova
npm install -g cordova@8.0.0

Remove the plugin and platform folders and re-build.

cordova platform add android
cordova build android

or with Ionic

ionic cordova platform add android
ionic cordova build android
Scott Logsdon
  • 71
  • 1
  • 4