cordova-plugin-background-mode
                                
                                
                                
                                    cordova-plugin-background-mode copied to clipboard
                            
                            
                            
                        Error : "plugin is not installed"
after i run the code and installed
 ionic cordova plugin add cordova-plugin-background-mode
 npm install --save @ionic-native/background-mode
i get this message error in console when i run the commend 'ionic cordova run android':
Native: tried calling BackgroundMode.enable, but the BackgroundMode plugin is not installed.
Install the BackgroundMode plugin: 'ionic plugin add cordova-plugin-background-mode'
                                    
                                    
                                    
                                
same fcking message I've got. Tried everything.... with no luck. And I don't understand why nobody give a fck about it. At least somebody should tell us what is going on or how they set it up
same thing....has anybody gotten this to work??
In my case the background mode is already installed but sometimes when i launch the app the error occurs.
Installing "cordova-plugin-background-mode" for android android-sdk version check failed ("/Users/karuppasamy/sites/mc_sales_poc/platforms/android/cordova/android_sdk_version"), continuing anyways. Plugin dependency "[email protected]" already fetched, using that version. Dependent plugin "cordova-plugin-device" already installed on android. Android Studio project detected Adding cordova-plugin-background-mode to package.json Saved plugin info for "cordova-plugin-background-mode" to config.xml Innbuilts-MacBook-Air:mc_sales_poc karuppasamy$ ionic cordova plugin add cordova-plugin-app-update
I installed this plugin and its Ionic Native wrapper today and got this exact same issue - or so I thought.
I wrapped every call to the plugin with this.platform.ready().then(() => ...) but still got the following error:
Native: tried calling BackgroundMode.unlock, but the BackgroundMode plugin is not installed.
Install the BackgroundMode plugin: 'ionic plugin add cordova-plugin-background-mode'
Then I realised I was actually successfully calling backgroundMode.enable() without error... it was only unlock(), wakeUp() and a few other methods from the documentation that were throwing that warning. I did some digging through the source code and it turned out those methods simply weren't even implemented in the version of the plugin I was using. This issue was actually already reported over a year ago - the latest semver-tagged version of the package resolved by npm (which cordova plugin add uses under the hood) is out of date.
To fix it, I changed the plugin spec from this:
<plugin name="cordova-plugin-background-mode" spec="^0.7.2" />
to this:
<plugin name="cordova-plugin-background-mode" spec="https://github.com/katzer/cordova-plugin-background-mode.git" />
Hope this helps someone!
@chrisfrancis27 :sir i executed above commands but i got below error in the console
error: lambda expressions are not supported in -source 1.6 getApp().runOnUiThread(() -> {
I managed to fix the problem on my end. Turns out the installation of the plugin was silently failing. Running it on "verbose" mode revealed it:
ionic cordova plugin add cordova-plugin-background-mode --verbose
After some digging, I tried the suggestion from Arun Girivasan, in a comment on this answer:
i fix the problem. downgraded cordova cli version. and reinstalled plugin
I was using cordova-cli version 9.0.0, downgraded to 8.1.2, and the plugin was installed successfully. Hope this helps someone.