Mobile Location
Moderators: LCNeil, heatherlaine, kevinmiller, elanorb
Mobile Location
How do I get the current location of a mobile device? I have tried several function to no avail.
Thanks
Mark
Thanks
Mark
Re: Mobile Location
Hi Mark,
We have a great lesson on implementing location based commands for mobile deveices here-
http://lessons.runrev.com/s/lessons/m/4 ... al-compass
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——
We have a great lesson on implementing location based commands for mobile deveices here-
http://lessons.runrev.com/s/lessons/m/4 ... al-compass
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——
Re: Mobile Location
I have read over the lesson and could not figure out how to get it to work. The only thing i could get to work was it to respond was true. My next question after i figure it out. How do I convert the coordinates into a location?
Also, When I use the following script on a substack the substack doesn't resize properly.
Also, When I use the following script on a substack the substack doesn't resize properly.
Code: Select all
set the fullScreenMode of this stack to "exactFit"
Re: Mobile Location
Hi Mark,
Lesson 4 of the idea2app school will explain how to convert the coordinates into a location (Google Maps). Please watch this lesson and attempt to implement the scripts explained by Elanor.
In regards to locations not working, please supply the stack/scripts you have attempted to use with locations and I should be able to tell you what could be causing the issue.
Your substack will not be resizing as you are you have only referenced "this stack" which will be the stack you are calling the script from. If you want to apply it to substack, you have to define this is your script.
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——
Lesson 4 of the idea2app school will explain how to convert the coordinates into a location (Google Maps). Please watch this lesson and attempt to implement the scripts explained by Elanor.
In regards to locations not working, please supply the stack/scripts you have attempted to use with locations and I should be able to tell you what could be causing the issue.
Your substack will not be resizing as you are you have only referenced "this stack" which will be the stack you are calling the script from. If you want to apply it to substack, you have to define this is your script.
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——
Re: Mobile Location
So i have to define which stacks to resize not on each stack script? Also, I have a substack that is 200 by 200 and it keeps resizing way bigger then that. How can I keep the stack the original size.
Where can I find lesson 4 about converting coordinates?
Where can I find lesson 4 about converting coordinates?
Re: Mobile Location
Hi Mark,
Yes you will have to define this as substack, although related to the main stack, are still separate stacks.
Lesson 4 is part of the idea2app course with all sessions being part of your LiveCode store account. Please login to your account and these will be available to view at your own pace.
I will need to see your stack/sample script to know why your stack is resizing as it could be many things causing this issue.
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——
Yes you will have to define this as substack, although related to the main stack, are still separate stacks.
Lesson 4 is part of the idea2app course with all sessions being part of your LiveCode store account. Please login to your account and these will be available to view at your own pace.
I will need to see your stack/sample script to know why your stack is resizing as it could be many things causing this issue.
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——
Re: Mobile Location
This is the script I am trying to use, but i can't get it to work. I am turning off and on the sensor on the card script.
Code: Select all
on mouseUp
put tLatitude& comma & tLongitude into field "Location" card "LNP"
end mouseUp
on showCurrentLocation
local tURL
## Get the url containing the current location
## and display it
put currentLocationURL() into tURL
displayURL tURL
end showCurrentLocation
function currentLocationURL
local tLatitude, tLongitude, tURL
## Get the current location
put item 1 of getCurrentLocation() into tLatitude
put item 2 of getCurrentLocation() into tLongitude
end currentLocationURL
function getCurrentLocation
local tLocationArray
## If on mobile
if the environment is "mobile" then
## Check the location sensor is running
if mobileSensorAvailable("location") then
put mobileCurrentLocation() into tLocationArray
## If it is get the current location and return the latitude and longitude
return tLocationArray["latitude"] & comma & tLocationArray["longitude"]
else
## Otherwise return empty
return empty
end if
else
## Otherwise return empty
return empty
end if
end getCurrentLocation
Re: Mobile Location
Hi Mark,
In the context of your script, tLatitue & tLongitude are temporary variables so calling them in the mouse up will not work as expected. This will simply put the words "tLatitued" & "tLongitude" into field "location"
You are also calling the displayURL hander within the showCurrent location handler but you do not seem to be handling this anywhere in your script. This will attribute to no values being returned.
something like the following should work when added to your full script-
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——
In the context of your script, tLatitue & tLongitude are temporary variables so calling them in the mouse up will not work as expected. This will simply put the words "tLatitued" & "tLongitude" into field "location"
You are also calling the displayURL hander within the showCurrent location handler but you do not seem to be handling this anywhere in your script. This will attribute to no values being returned.
something like the following should work when added to your full script-
Code: Select all
on showCurrentLocation
local tURL
## Get the url containing the current location
## and display it
put currentLocationURL() into tURL
displayURL tURL
end showCurrentLocation
on displayUrl pUrl
put pURL into field "Location" card "LNP"
end displayURL
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——
Re: Mobile Location
With adding the new script I can't get the script to produce anything. I am not sure what I am doing wrong.
Re: Mobile Location
HI Mark,
Please post your stack as it will be easier for us to investigate what could be causing the issue.
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——
Please post your stack as it will be easier for us to investigate what could be causing the issue.
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——
Re: Mobile Location
Hi Mark,
I have had a look at your stack and you have no way of calling any of your location scripts as, even though they are on a button, there is no mouse messages (e.g. mouseUp, mouseDown etc)
Adding the following to your pin button triggers the scripts-
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
—
I have had a look at your stack and you have no way of calling any of your location scripts as, even though they are on a button, there is no mouse messages (e.g. mouseUp, mouseDown etc)
Adding the following to your pin button triggers the scripts-
Code: Select all
on mouseUp
showCurrentLocation
end mouseUp
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
—
Re: Mobile Location
Now how do I convert the longitude and latitude to a city?
Re: Mobile Location
Hi Mark,
This is explained in the Lesson 4 of the idea2app course where Elanor parses location data to google maps.
More specifically, creating a URL that contains the location data- e.g.
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——
This is explained in the Lesson 4 of the idea2app course where Elanor parses location data to google maps.
More specifically, creating a URL that contains the location data- e.g.
Code: Select all
https://www.google.com/maps/preview?q=24.197611,120.780512
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——
Re: Mobile Location
I don't want to show the location on a map. I just want the location to be displayed in a field.
Re: Mobile Location
Hi Mark,
You will have to do this manually as there is no direct way to do this in LiveCode. The process is called GeoCoding with more information be available here-
http://en.wikipedia.org/wiki/Geocoding
Google have a GeoCoding API which you may find useful
https://developers.google.com/maps/docu ... ding/#JSON
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——
You will have to do this manually as there is no direct way to do this in LiveCode. The process is called GeoCoding with more information be available here-
http://en.wikipedia.org/wiki/Geocoding
Google have a GeoCoding API which you may find useful
https://developers.google.com/maps/docu ... ding/#JSON
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——