28 lines
788 B
TypeScript
28 lines
788 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import { Geolocation } from '@capacitor/geolocation';
|
|
import { SessionDataProviderService } from 'src/app/store/session-data-provider.service';
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class LocTrcService {
|
|
|
|
constructor(public sessionDataProviderService: SessionDataProviderService) {
|
|
|
|
|
|
}
|
|
|
|
async startTracking(){
|
|
if ( this.sessionDataProviderService.tracking == 0 ){
|
|
return; // dont do if mnot enabled
|
|
}
|
|
const coordinates = await Geolocation.getCurrentPosition();
|
|
//debugger;
|
|
console.log('Current position 0000:', coordinates);
|
|
const printCurrentPosition = async () => {
|
|
const coordinates = await Geolocation.getCurrentPosition();
|
|
|
|
console.log('Current position:', coordinates);
|
|
};
|
|
}
|
|
}
|