Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70894

geolocation.watchPosition() not working in android real device

$
0
0

@Ram1122 wrote:

Hi i am learner in ionic and present in my application i am trying to get user location using below code but its not working i mean lat and longs are coming in android real device ,Is there any better solution for getting user current location can some one help me please

this.geolocation.getCurrentPosition().then((resp) => {
}).catch((error) => {
console.log(‘Error getting location’, error);
});

let watch = this.geolocation.watchPosition();

watch.subscribe((data) => {
this.data = data;
console.log("----->Watch latitude" + data.coords.latitude);
console.log("-----> Watch logitude" + data.coords.longitude)
console.log("-----> Watch accuracy" + data.coords.accuracy)
});

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70894

Trending Articles