transistorsoft / cordova-background-geolocation-SampleApp

Cordova Background Geolocation Sample Application
https://www.transistorsoft.com/shop/products/cordova-background-geolocation
MIT License
122 stars 78 forks source link

Ionic 4 - Cannot read property 'onLocation' of undefined TypeError: Cannot read property 'onLocation' of undefined #113

Closed zsgithublib closed 5 years ago

zsgithublib commented 5 years ago

After converting the simple map example to Ionic 4, the import function fails, with an error

import BackgroundGeolocation, { Location, HttpEvent, HeartbeatEvent, MotionActivityEvent, ProviderChangeEvent, MotionChangeEvent, ConnectivityChangeEvent } from "cordova-background-geolocation-lt";

ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'onLocation' of undefined TypeError: Cannot read property 'onLocation' of undefined at Function.push../node_modules/cordova-background-geolocation-lt/src/ionic/index.js.BackgroundGeolocation.onLocation (index.js:181)

(See attached filed)

What is the proper way to import this plugin in Ionic 4?

tab4.page.ts.zip

christocracy commented 5 years ago

This is not the Cordova plugin repo. This is the SampleApp repo.

https://github.com/transistorsoft/cordova-background-geolocation-lt