mobileCurrentLocation() not working on android

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
BigameOver
Posts: 39
Joined: Thu Jan 23, 2020 5:56 pm

mobileCurrentLocation() not working on android

Post by BigameOver » Tue Jan 05, 2021 3:09 pm

Hi,
I am trying to get the current location from an android device using mobileCurrentLocation(), but it seems it returns empty.

Code: Select all

mobileSensorAvailable("location")
mobileStartTrackingSensor "location"
put mobileCurrentLocation() into theLocation
When I try to answer the result, i get nothing.
What can I do?
thank you,
BigameOver

strongbow
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 135
Joined: Mon Jul 31, 2006 1:39 am
Location: New Zealand, Australia, Germany, Japan
Contact:

Re: mobileCurrentLocation() not working on android

Post by strongbow » Wed Jan 06, 2021 6:21 am

It returns an array so check the keys and values of each, perhaps using an arrayToText function.

HTH

BigameOver
Posts: 39
Joined: Thu Jan 23, 2020 5:56 pm

Re: mobileCurrentLocation() not working on android

Post by BigameOver » Wed Jan 06, 2021 10:52 am

strongbow wrote:
Wed Jan 06, 2021 6:21 am
It returns an array so check the keys and values of each, perhaps using an arrayToText function.

HTH
At first I thought I should do like this

Code: Select all

answer theLocation[1]
I thought it works with only numbers. But now I understand where was my mistake

Code: Select all

answer theLocation[latitude]
Thank you

SparkOut
Posts: 2839
Joined: Sun Sep 23, 2007 4:58 pm

Re: mobileCurrentLocation() not working on android

Post by SparkOut » Wed Jan 06, 2021 12:04 pm

Quote the literal string for the keys as well :)

Code: Select all

answer theLocation["latitude"]

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: mobileCurrentLocation() not working on android

Post by Klaus » Wed Jan 06, 2021 12:11 pm

And consult the dictionary if in doubt! 8)

Post Reply

Return to “Android Deployment”