transistorsoft/nativescript-background-geolocation-lt

Property 'onLocation' does not exist on type 'AppComponent'.

Closed this issue · 1 comments

i am using in nativescript angular project and all event listeners show's this error
image

this is my code in app.component.ts
` private _state: any;

constructor() {

// 1. Listen to events
BackgroundGeolocation.on("location", this.onLocation.bind(this));
BackgroundGeolocation.on("motionchange", this.onMotionChange.bind(this));
BackgroundGeolocation.on("http", this.onHttp.bind(this));
BackgroundGeolocation.on("heartbeat", this.onHeartbeat.bind(this));
BackgroundGeolocation.on("schedule", this.onSchedule.bind(this));
BackgroundGeolocation.on("error", this.onError.bind(this));

// 2. Configure it.
BackgroundGeolocation.configure({
  debug: true,
  desiredAccuracy: 0,
  stationaryRadius: 25,
  distanceFilter: 50,
  activityRecognitionInterval: 10000,
  url: 'http://localhost:8080/locations',
  autoSync: true
}, (state) => {
  // 3. Plugin is now ready to use.
  if (!state.enabled) {
    BackgroundGeolocation.start();
  }
});
// NOTE:  Do not execute *any* method which access location-services until
//  the callback to #configure method executes:

}`

How can i implement this with angular nativescript please guide with some details step by step

That example code you pasted assumes the existence of those functions in YOUR app component.

YOU have to define those functions.