I have an application that displays on the screen the latitude and longitude wanted to know how to write this data in firebase
My code home.ts ta so
import { Component } from '@angular/core';
import {NavController, Platform} from 'ionic-angular'; import {Geolocation, GeolocationOptions, Geoposition} from '@ ionic-native / geolocation';
@Component ({ selector: 'page-home', templateUrl: 'home.html' }) export class HomePage {
geoposition: Geoposition
geolocationOptions: GeolocationOptions
constructor(private platform: Platform,
private geolocation: Geolocation,
public navCtrl: NavController){
}
async getGeolocation(){
await this.platform.ready();
try {
this.geolocationOptions = {
maximumAge: 1000,
timeout: 1000,
enableHighAccuracy: true
}
this.geoposition = await this.geolocation.getCurrentPosition(this.geolocationOptions);
}
catch(e){
console.error(e)
}
}
}
the html that displays the data on the screen
<ion-list>
<ion-item>
Accurary: {{geoposition.coords.accuracy}}
</ion-item>
<ion-item>
Latitude: {{geoposition.coords.latitude}}
</ion-item>
<ion-item>
Longitude: {{geoposition.coords.longitude}}
</ion-item>
<ion-item>
Timestamp:{{geoposition.timestamp |date}}
</ion-item>