mobileCurrentLocation()

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Geoff.Macumber
Posts: 30
Joined: Tue Aug 12, 2014 7:15 am
Location: Australia
Contact:

mobileCurrentLocation()

Post by Geoff.Macumber » Tue Jan 31, 2017 6:35 am

Hi All,

I am having some difficulty getting some of the commands/functions to work for android. So far I can't get any socket functions to work although I have had them working extensively in a live application for over two years. I will have to do some more work on that before I can say that I am stuck.

My main problem at the moment is trying to find out the current geo location data. Can someone tell me if there is something wrong with the following?

In card script....
on openCard
if the environment is "mobile" then
mobileStartTrackingSensor "location"
end if
end openCard

on closeCard
if the environment is "mobile" then
mobileStopTrackingSensor "location"
end if
end closeCard

In a button script....
on mouseUp
if the environment is not "mobile" then
beep
answer "Sorry, mobile only!"
exit mouseUp
end if
if mobileCanTrackLocation() is "true" then
answer "The location can be tracked"
else
answer "The location CANNOT be tracked"
exit mouseUp
end if
put "" into field "fldGeoData"

I get the message "The location CANNOT be tracked" and absolutely nothing else happens and I get nothing into the data field. I am using android version 6.

Has anyone else been able to get this stuff to work on android?

Regards,

Geoff Macumber.

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: mobileCurrentLocation()

Post by LiveCode_Panos » Tue Jan 31, 2017 1:20 pm

Hi Geoff,

Just a guess: Have you enabled the location-related permissions in Standalone Application Settings (for Android)?

Make sure "Fine Location" and "Coarse Location" are enabled.

Best,
Panos
--

PS: You might also need the "Internet" permission.

Geoff.Macumber
Posts: 30
Joined: Tue Aug 12, 2014 7:15 am
Location: Australia
Contact:

Re: mobileCurrentLocation()

Post by Geoff.Macumber » Tue Jan 31, 2017 11:04 pm

Hi Panos,

You are a genius! Thank you for that.

This is my first foray into all things mobile and I am having almost as much frustration with it as I did when I first started using LiveCode.

On another note, where can I find documentation on the settings for stand alone application deployment for android and iOS. The documentation includes the screens and settings for all deployments except these two.

Also if you can give me a clue as to why my socket code (which has been running unchanged for two years on windows) doesn't work. Are there any settings that affect it?

Again, thanks a million!

Regards,
Geoff Macumber

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: mobileCurrentLocation()

Post by LiveCode_Panos » Wed Feb 01, 2017 6:22 pm

Hi Geoff,

You are welcome. You can have a look at this lesson, which includes info about the Standalone Settings for every platform, including iOS and Android:

http://lessons.livecode.com/m/4603/l/68 ... n-settings

Regarding your sockets code, this is trickier to guess :) I *think* "Internet" permission is required on Android for sockets.

Best,
Panos
--

Geoff.Macumber
Posts: 30
Joined: Tue Aug 12, 2014 7:15 am
Location: Australia
Contact:

Re: mobileCurrentLocation()

Post by Geoff.Macumber » Wed Feb 01, 2017 9:21 pm

Once again, thanks Panos.

Post Reply

Return to “Android Deployment”