mauron85/cordova-plugin-background-geolocation

Cannot read property 'backgroundGeoLocation' of undefined

Opened this issue · 1 comments

Hi,

I'm getting this error:

I chromium: [INFO:CONSOLE(310)] "TypeError: Cannot read property 'backgroundGeoLocation' of undefined
I chromium: at Object.factory.initialiseBackgroundGeolocation (file:///android_asset/www/assets/ng/factories/GeolocationFactory.js:110:28)
I chromium: at file:///android_asset/www/assets/ng/setup/init.js:67:30
I chromium: at file:///android_asset/www/assets/ng/factories/SettingsFactory.js:368:7
I chromium: at FileReader.fileReader.onloadend (file:///android_asset/www/assets/ng/factories/FileFactory.js:190:13)
I chromium: at FileReader.readSuccessCallback (file:///android_asset/www/plugins/cordova-plugin-file/www/FileReader.js:164:18)
I chromium: at Object.callbackFromNative (file:///android_asset/www/cordova.js:291:58)
I chromium: at :1:9", source: file:///android_asset/www/cordova.js (310)
I chromium: [INFO:CONSOLE(312)] "Uncaught TypeError: Cannot read property 'backgroundGeoLocation' of undefined", source: file:///android_asset/www/cordova.js (312)
I chromium: [INFO:CONSOLE(81)] "Send queue Fire All called", source: file:///android_asset/www/assets/ng/factories/SendQueueFactory.js (81)
I chromium: [INFO:CONSOLE(89)] "Firing send queue", source: file:///android_asset/www/assets/ng/factories/SendQueueFactory.js (89)
I chromium: [INFO:CONSOLE(127)] "sendQueue: 0", source: file:///android_asset/www/assets/ng/factories/SendQueueFactory.js (127)

Device: pixel 2 emulator in android studio

tried 2 versions, 2.3.6 and 3.0.1

Installed platforms:
android 7.1.4
browser 5.0.4

Cordova 8.1.0
Gradle 4.10.3

Plugins:

cordova-android-support-gradle-release 3.0.1 "cordova-android-support-gradle-release"
cordova-clipboard 1.3.0 "Clipboard"
cordova-plugin-app-version 0.1.12 "AppVersion"
cordova-plugin-background-mode 0.7.3 "BackgroundMode"
cordova-plugin-battery-status 2.0.3 "Battery"
cordova-plugin-camera 4.1.0 "Camera"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-dialogs 2.0.2 "Notification"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-foreground-service 1.1.3 "Cordova Foreground Service"
cordova-plugin-geolocation 4.1.0 "Geolocation"
cordova-plugin-mauron85-background-geolocation 2.3.6 "CDVBackgroundGeolocation"
cordova-plugin-navigationbar 1.0.31 "Cordova NavigationBar plugin"
cordova-plugin-vibration 3.1.1 "Vibration"
cordova-plugin-whitelist 1.3.4 "Whitelist"

An app goes white screen when the error occurs.

It seems that, at some point, this plugin renamed backgroundGeolocation to BackgroundGeolocation and changed the interface slightly.

I renamed all my references, and switched to using BackgroundGeolocation.on('location', handler) to receive location changes and it now works.