Page 1 of 1

mobileCurrentLocation()

Posted: Tue Jan 31, 2017 6:35 am
by Geoff.Macumber
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.

Re: mobileCurrentLocation()

Posted: Tue Jan 31, 2017 1:20 pm
by LiveCode_Panos
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.

Re: mobileCurrentLocation()

Posted: Tue Jan 31, 2017 11:04 pm
by Geoff.Macumber
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

Re: mobileCurrentLocation()

Posted: Wed Feb 01, 2017 6:22 pm
by LiveCode_Panos
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
--

Re: mobileCurrentLocation()

Posted: Wed Feb 01, 2017 9:21 pm
by Geoff.Macumber
Once again, thanks Panos.