_From @DaniloCouto on June 30, 2016 20:42_
Type: bug
Ionic Version: 2.x
Platform: android 5.0 webview
BackgroundGeolocation methods returns 'Plugin not Installed' whenever I use.
Ionic info
Cordova CLI: 6.2.0
Ionic Framework Version: 2.0.0-beta.9
Ionic CLI Version: 2.0.0-beta.32
Ionic App Lib Version: 2.0.0-beta.18
OS:
Node Version: v5.6.0
Ionic plugin ls
cordova-plugin-compat 1.0.0 "Compat"
cordova-plugin-console 1.0.3 "Console"
cordova-plugin-device 1.1.2 "Device"
cordova-plugin-geolocation 2.2.0 "Geolocation"
cordova-plugin-mauron85-background-geolocation 2.1.2 "CDVBackgroundGeolocation"
cordova-plugin-splashscreen 3.2.2 "Splashscreen"
cordova-plugin-statusbar 2.1.3 "StatusBar"
cordova-plugin-whitelist 1.2.2 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"
ionic platform ls
Installed platforms:
android 5.1.1
_Copied from original issue: driftyco/ionic#7147_
Hello! Thanks for using Ionic! Are you using ionic-native when you get this error?
_From @DaniloCouto on July 1, 2016 13:32_
Hello,
Yes, I'm using ionic-native.
I'm building a provider to call BackgroundGeolocation.
import {BackgroundGeolocation} from 'ionic-native';
Other plugins like Geolocation works great.
Thanks for answering,
Ahh ok, thanks! Since this is an ionic native issue i am going to move this issue to the Ionic-Native repo. Thanks for using Ionic!
Same platform, same versions, same problem here!
Me too!.. Having the same issue using ionic-native. I have switched to using the "window.backgroundGeolocation" method...
I'm having same problem using ionic-native from ionic 2 beta 10. Someone knows how to fix it or another way to implement background geolocation?
I'm getting the warning as well, any workaround? on iOS however
@AVatch I think you'll just have to use it the javascript way for now until resolve..
this works for android and iOS
` declare var window: any; //put this after imports
initBackgroundGeo2(isActivate) {
this.platform.ready().then(() => {
let config = {
desiredAccuracy: 10,
stationaryRadius: 20,
distanceFilter: 30,
debug: true,
stopOnTerminate: false
// interval: 30 * 60 * 1000 //30 min
}
var callbackFn = function(location){
console.log('Location => ' + location.latitude + ',' + location.longitude);
window.backgroundGeolocation.finish();
}
var errorFn = function(error) {
console.log('BackgroundGeolocation error');
}
window.backgroundGeolocation.configure(callbackFn, errorFn, config);
if(isActivate=="true"){
window.backgroundGeolocation.start();
}
else{
window.backgroundGeolocation.stop();
}
});
}`
Mm is possible to use that way on Ionic 2 Beta 10 with only support to TS ?
TS is a superset of JavaScript, so you can use JavaScript anywhere in your code.
I'm on ionic 2 beta 10 and it works like a charm for me.
Should be fixed now.
The plugin not installed error happens when ionic-native fails to find the pluginRef provided in the wrapper definition. The pluginRef was set to plugins.backgroundGeoLocation instead of backgroundGeolocation
Hi, I think that the problem is not solved, maybe my mistake ?
On iOs if i follow the documentation : https://ionicframework.com/docs/native/background-geolocation/ i got the same error.
Ionic info :
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.13.1
ionic (Ionic CLI) : 3.13.2
global packages:
cordova (Cordova CLI) : 7.0.1
local packages:
@ionic/app-scripts : 3.0.1
Cordova Platforms : android 6.2.3 ios 4.5.0
Ionic Framework : ionic-angular 3.8.0
System:
Android SDK Tools : 26.0.2
ios-sim : 6.1.2
Node : v6.11.3
npm : 3.10.10
OS : macOS Sierra
Xcode : Xcode 9.0.1 Build version 9A1004
Misc:
backend : pro
Installed platform :
android 6.2.3
ios 4.5.0
````
Installed plugins :
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-ionic-webview 1.1.16 "cordova-plugin-ionic-webview"
cordova-plugin-mauron85-background-geolocation 2.2.5 "CDVBackgroundGeolocation"
cordova-plugin-screen-orientation 2.0.1 "Screen Orientation"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-whitelist 1.3.1 "Whitelist"
cordova-sqlite-storage 2.0.4 "Cordova sqlite storage plugin"
es6-promise-plugin 4.1.0 "Promise"
ionic-plugin-keyboard 2.2.1 "Keyboard"
```
Tested on iOs Emulator 6+

why closed above issue still got same error in the ionic3 version i am using :
"@ionic-native/background-geolocation": "^3.14.0"
anybody how to fix above error?
Same problem here!
Also getting this.
[console.warn]: "Native: tried calling BackgroundGeolocation.finish, but the BackgroundGeolocation plugin is not installed."
[ng] [console.warn]: "Install the BackgroundGeolocation plugin: 'ionic cordova plugin add @mauron85/cordova-plugin-background-geolocation'"
cordova-plugin-customurlscheme 4.4.0 "Custom URL scheme"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-ionic 5.3.0 "cordova-plugin-ionic"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.0.1 "cordova-plugin-ionic-webview"
cordova-plugin-mauron85-background-geolocation 3.0.3 "CDVBackgroundGeolocation"
cordova-plugin-native-spinner 1.1.3 "Native Spinner"
cordova-plugin-safariviewcontroller 1.5.4 "SafariViewController"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-telerik-imagepicker 2.2.4 "ImagePicker"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-sqlite-storage 3.0.0 "Cordova sqlite storage plugin - cordova-sqlite-storage plugin version"
Ionic:
Ionic CLI : 5.0.1 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.4.2
@angular-devkit/build-angular : 0.12.4
@angular-devkit/schematics : 7.2.4
@angular/cli : 7.2.4
@ionic/angular-toolkit : 1.5.1
Cordova:
Cordova CLI : 9.0.0 ([email protected])
Cordova Platforms : ios 5.0.1
Cordova Plugins : cordova-plugin-ionic 5.3.0, cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 12 other plugins)
Utility:
cordova-res : 0.3.0
native-run : 0.2.3
System:
ios-deploy : 1.9.4
ios-sim : 8.0.1
NodeJS : v11.6.0 (/usr/local/bin/node)
npm : 6.9.0
OS : macOS Mojave
Xcode : Xcode 10.2.1 Build version 10E1001
same for me...
Same, but only when I use the method watchLocation()
any updates here?
The problem seems to pseudo-fix if you call the functions from within app.component.ts instead of from a service, just as stated on the Setup Guide:
BackgroundGeolocation must be called within app.ts and or before Geolocation. Otherwise...
This seems weird to me, it should be able to work from any class or service.
The problem keeps coming back when pulling the repo. As pointed in mauron85/cordova-plugin-background-geolocation#613, the problem seems to be that the scoped package @mauron85/cordova-plugin-background-geolocation is installed correctly the first time on a local machine but added to package.json as cordova-plugin-background-geolocation. So the next time the repo is pulled it will install the wrong package (you can verify this by looking at plugins/cordova-plugin-background-geolocation/package.json).
What's working for me so far is adding the plugin directly in package.json (@maruon85/cordova-...) so the correct plugin gets installed after adding or preparing the platform. However, the "incorrect" plugin keeps being added to the package.json but it doesn't seem to interfere anymore (a hook script may be needed to prevent this?).
// package.json
{
"@mauron85/cordova-plugin-background-geolocation": "^3.1.0",
"cordova": {
"plugins": {
"@mauron85/cordova-plugin-background-geolocation": {}
}
}
}
Then the "plugin not installed" message keeps showing but it's just a warning and the plugin seems to be working ok.
@RaschidJFR
`{
"name": "BackgroundTestApp",
"version": "1.0.0",
"author": "Ali Exalter",
"homepage": "http://google.uk/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "~8.1.2",
"@angular/core": "~8.1.2",
"@angular/forms": "~8.1.2",
"@angular/platform-browser": "~8.1.2",
"@angular/platform-browser-dynamic": "~8.1.2",
"@angular/router": "~8.1.2",
"@ionic-native/background-geolocation": "^5.24.0",
"@ionic-native/core": "^5.0.0",
"@ionic-native/firebase": "^5.23.0",
"@ionic-native/firebase-x": "^5.23.0",
"@ionic-native/http": "^5.25.0",
"@ionic-native/splash-screen": "^5.22.0",
"@ionic-native/sqlite": "^5.22.0",
"@ionic-native/status-bar": "^5.22.0",
"@ionic/angular": "^5.0.0",
"@mauron85/cordova-plugin-background-geolocation": "^3.1.0",
"angular2-signaturepad": "^2.11.0",
"angularfire2": "^5.4.2",
"cordova-android": "^8.1.0",
"cordova-ios": "^5.1.1",
"cordova-plugin-advanced-http": "^2.4.1",
"cordova-plugin-androidx": "^1.0.2",
"cordova-plugin-androidx-adapter": "^1.1.0",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-firebasex": "^9.0.2-cli",
"cordova-plugin-ionic": "^5.4.6",
"cordova-plugin-splashscreen": "^5.0.3",
"cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-whitelist": "^1.3.4",
"cordova-sqlite-storage": "^5.0.0",
"core-js": "^2.5.4",
"firebase": "^7.14.0",
"ion2-calendar": "^3.0.0-rc.0",
"ionicsignaturepad": "^1.0.1",
"moment": "^2.24.0",
"ngx-order-pipe": "^2.0.4",
"rxjs": "~6.5.1",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/architect": "~0.801.2",
"@angular-devkit/build-angular": "~0.801.2",
"@angular-devkit/core": "~8.1.2",
"@angular-devkit/schematics": "~8.1.2",
"@angular/cli": "^8.1.3",
"@angular/compiler": "~8.1.2",
"@angular/compiler-cli": "~8.1.2",
"@angular/language-service": "~8.1.2",
"@ionic/angular-toolkit": "^2.1.1",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^4.1.3",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.4.3"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-ionic-webview": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-ionic": {
"APP_ID": "3dde3072",
"CHANNEL_NAME": "Master",
"UPDATE_METHOD": "background",
"MAX_STORE": "2",
"MIN_BACKGROUND_DURATION": "30",
"UPDATE_API": "https://api.ionicjs.com"
},
"cordova-sqlite-storage": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-device": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-firebasex": {},
"@mauron85/cordova-plugin-background-geolocation": {
"GOOGLE_PLAY_SERVICES_VERSION": "11+",
"ANDROID_SUPPORT_LIBRARY_VERSION": "26+",
"ICON": "@mipmap/icon",
"SMALL_ICON": "@mipmap/icon",
"ALWAYS_USAGE_DESCRIPTION": "App requires background tracking ",
"MOTION_USAGE_DESCRIPTION": "App requires motion detection"
},
"cordova-plugin-advanced-http": {
"OKHTTP_VERSION": "3.10.0"
}
},
"platforms": [
"ios",
"android"
]
}
}`
I have only @mauron85 plugin in my package.json still i am getting error on this.backgroundGeolocation.finish(); plugin not installed.
@aliexalter Your root package.json seems ok. Try this:
Check plugins/cordova-plugin-background-geolocation/package.json, it should look something like this:
{
"name": "@mauron85/cordova-plugin-background-geolocation", // <- Please note the '@mauron85/' part
"version": "3.1.0",
// ...
}
Make sure you are calling the plugin after the platform has been initialized: Platform.ready().then(() => /* Call here the plugin functions */ ));
I've been getting this problem all the time that I use the plugin:

Here is my package.json:
{
"name": "rastreador",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "~8.1.2",
"@angular/compiler": "~8.1.2",
"@angular/core": "~8.1.2",
"@angular/forms": "~8.1.2",
"@angular/platform-browser": "~8.1.2",
"@angular/platform-browser-dynamic": "~8.1.2",
"@angular/router": "~8.1.2",
"@fortawesome/angular-fontawesome": "^0.5.0",
"@fortawesome/fontawesome-svg-core": "^1.2.26",
"@fortawesome/free-brands-svg-icons": "^5.12.0",
"@fortawesome/free-regular-svg-icons": "^5.12.0",
"@fortawesome/free-solid-svg-icons": "^5.12.0",
"@ionic-native/background-geolocation": "^5.27.0",
"@ionic-native/camera": "^5.22.0",
"@ionic-native/core": "^5.20.0",
"@ionic-native/device": "^5.20.0",
"@ionic-native/geolocation": "^5.20.0",
"@ionic-native/launch-navigator": "^5.20.0",
"@ionic-native/screen-orientation": "^5.20.0",
"@ionic-native/splash-screen": "^5.20.0",
"@ionic-native/status-bar": "^5.20.0",
"@ionic/angular": "^4.11.10",
"@ionic/storage": "^2.2.0",
"@mauron85/cordova-plugin-background-geolocation": "^3.1.0",
"angular2-signaturepad": "^2.11.0",
"cordova-android": "8.1.0",
"cordova-browser": "6.0.0",
"cordova-plugin-actionsheet": "^2.3.3",
"cordova-plugin-camera": "^4.1.0",
"cordova-plugin-dialogs": "^2.0.2",
"cordova-plugin-geolocation": "^4.0.2",
"cordova-plugin-screen-orientation": "^3.0.2",
"cordova-sqlite-storage": "^4.0.0",
"core-js": "^2.6.11",
"es6-promise-plugin": "^4.2.2",
"platform": "1.3.5",
"rxjs": "^6.5.4",
"tslib": "^1.9.0",
"uk.co.workingedge.phonegap.plugin.launchnavigator": "^5.0.4",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/architect": "~0.801.2",
"@angular-devkit/build-angular": "~0.801.2",
"@angular-devkit/core": "~8.1.2",
"@angular-devkit/schematics": "~8.1.2",
"@angular/cli": "~8.1.2",
"@angular/compiler": "~8.1.2",
"@angular/compiler-cli": "~8.1.2",
"@angular/language-service": "~8.1.2",
"@ionic/angular-toolkit": "~2.0.0",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "^5.2.1",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^4.1.3",
"cordova-plugin-splashscreen": "^5.0.3",
"cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-whitelist": "^1.3.4",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.5.1",
"protractor": "^5.4.3",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.4.3"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-geolocation": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
},
"cordova-plugin-ionic-keyboard": {},
"uk.co.workingedge.phonegap.plugin.launchnavigator": {
"GOOGLE_API_KEY_FOR_ANDROID": "AIzaSyCz21QM29W7JzhJEHubyNQ4SPY3N_c43cs",
"OKHTTP_VERSION": "3.12.0"
},
"cordova-sqlite-storage": {},
"cordova-plugin-camera": {},
"cordova-plugin-screen-orientation": {},
"cordova-plugin-background-geolocation": {}
},
"platforms": [
"browser",
"android"
]
}
}
And here my plugins/cordova-plugin-background-geolocation/package.json:
{
"_from": "cordova-plugin-background-geolocation",
"_id": "[email protected]",
"_inBundle": false,
"_integrity": "sha1-b7FJQz8rowCSXEO4yzc00MYh2V4=",
"_location": "/cordova-plugin-background-geolocation",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "cordova-plugin-background-geolocation",
"name": "cordova-plugin-background-geolocation",
"escapedName": "cordova-plugin-background-geolocation",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#USER"
],
"_resolved": "https://registry.npmjs.org/cordova-plugin-background-geolocation/-/cordova-plugin-background-geolocation-1.0.6.tgz",
"_shasum": "6fb149433f2ba300925c43b8cb3734d0c621d95e",
"_spec": "cordova-plugin-background-geolocation",
"_where": "D:\\SN\\branches\\Komodus_App\\Teste_Luiz",
"author": "",
"bugs": {
"url": "https://github.com/ZenCity/cordova-plugin-background-geolocation/issues"
},
"bundleDependencies": false,
"cordova": {
"id": "cordova-plugin-background-geolocation-zencity",
"platforms": [
"android",
"ios",
"wp8"
]
},
"deprecated": false,
"description": "Cordova Background GeoLocation Plugin",
"engines": [
{
"name": "cordova",
"version": ">=3.0.0"
}
],
"homepage": "https://github.com/ZenCity/cordova-plugin-background-geolocation#readme",
"keywords": [
"phonegap",
"background geolocation",
"ecosystem:cordova",
"cordova-android",
"cordova-ios",
"cordova-wp8"
],
"license": "MIT",
"name": "cordova-plugin-background-geolocation",
"repository": {
"type": "git",
"url": "git+https://github.com/ZenCity/cordova-plugin-background-geolocation.git"
},
"version": "1.0.6"
}
How I can solve it?
@lrcampos97 By looking at your plugins/cordova-plugin-background-geolocation/package.json I can see the wrong plugin has been installed: cordova-plugin-background-geolocation instead of @mauron85/cordova-plugin-background-geolocation.
Try this:
$ cordova platform rm androidplugins folder$ cordova plugin rm cordova-plugin-background-geolocation$ cordova plugin add @mauron85/cordova-plugin-background-geolocation$ cordova platform add androidIf everything goes right, you should see in your package.json this:
// package.json
{
"cordova": {
"plugins": {
"@mauron85/cordova-plugin-background-geolocation": { // <-- this has '@mauron85/'
// ...
}
},
}
And your plugins/cordova-plugin-background-geolocation/package.json should show:
// plugins/../package.json
{
"_from": "@mauron85/[email protected]",
// ...
}
@RaschidJFR Thank you for your response, this worked for me with a small change.
So, I did all steps that you told. And one thing was different in my packge.json
// package.json
{
"cordova": {
"plugins": {
"cordova-plugin-background-geolocation": {} // <-- after all steps this continued like this
},
}
Then, I just manually change for your example and the problem was resolved
This plugin has other strong problems with Ionic, for example, this one #678 , that I need always create the folder mipmap :(
Glad it helped. Check this other thread mauron85/cordova-plugin-background-geolocation#686, maybe that's the issue you're talking about.
Most helpful comment
@lrcampos97 By looking at your
plugins/cordova-plugin-background-geolocation/package.jsonI can see the wrong plugin has been installed:cordova-plugin-background-geolocationinstead of@mauron85/cordova-plugin-background-geolocation.Try this:
$ cordova platform rm androidpluginsfolder$ cordova plugin rm cordova-plugin-background-geolocation$ cordova plugin add @mauron85/cordova-plugin-background-geolocation$ cordova platform add androidIf everything goes right, you should see in your
package.jsonthis:And your
plugins/cordova-plugin-background-geolocation/package.jsonshould show: