Page 1 of 1

Displaying Google Maps (current location) using iPad GPS

Posted: Fri Jan 10, 2014 7:15 am
by Kevvy
Hi Guys,

I am quite new to the livecode scene and want to know if this is possible.
I am trying to get the current location of the device (iPad) running the app and display it inside the app using the google maps API.

I already have a working HTML page which shows the current location if you run it inside a browser but it does not want to work inside the livecode app.
I have tried a few other example stacks but with no success.

Here is an example of some of the code in the stack:

global browserID
on mouseUp
put revBrowserOpen (the windowId of this stack, "url here") into browserID
revBrowserSet browserID, "scrollbars", false
revBrowserSet browserID, "showborder", true
revBrowserSet browserID, "rect",rect of image "browserimage"
put mobileCurrentLocation() into tLocation
answer tLocation -- This was to see if I cannot pass on the current co-ords to the html page instead of it relying on the internal sensor, I receive no answer though..
end mouseUp


Thanks

Regards.

Re: Displaying Google Maps (current location) using iPad GPS

Posted: Fri Jan 10, 2014 7:39 am
by Simon
Hi Kevvy,
Welcome to the forum.

I take it you've seen that mobileCurrentLocation() returns an array with lat and long.
So you just grab them and tag them on the end of the URl.
e.g. http://maps.google.com/maps?q=55.953969,-3.198784

Simon
Edit.. You can't view an array with the answer dialog.

Re: Displaying Google Maps (current location) using iPad GPS

Posted: Fri Jan 10, 2014 8:43 am
by Kevvy
Thanks Simon :)

I tried the following:

put mobileCurrentLocation() into tLocation
put tLocation['latitude'] into lati
answer "Latitude:" & lati

And it returned blank on my iPad. Do you have to initialise location tracking first somewhere ?

Thanks again for the help.

Re: Displaying Google Maps (current location) using iPad GPS

Posted: Fri Jan 10, 2014 8:49 am
by Simon
Yes, you have to mobileStartTrackingSensor.

Here:
http://lessons.runrev.com/s/lessons/m/4 ... al-compass
Tons of stuff to read in the Lessons.
You should start with them.

Simon

Re: Displaying Google Maps (current location) using iPad GPS

Posted: Fri Jan 10, 2014 9:49 am
by Kevvy
thanks Simon, I got the tracking working and sending the lat and long on to the google maps page. However for the life of me I cannot get the browser image displaying on my iPad. It displays on my windows box but not on my mac box (both have a connection to the internet and that specific php page which generates the map.

does anyone have any ideas to display an image of a webpage inside an iOS application ? :(

Regards

Re: Displaying Google Maps (current location) using iPad GPS

Posted: Fri Jan 10, 2014 10:23 am
by Simon
What happens when put the URL into iPad's Safari?

Simon

Re: Displaying Google Maps (current location) using iPad GPS

Posted: Fri Jan 10, 2014 11:38 am
by Kevvy
Simon wrote:What happens when put the URL into iPad's Safari?

Simon
it opens up fine. i found the browser control tutorial which I am working through to see if i can find a solution.

Re: Displaying Google Maps (current location) using iPad GPS

Posted: Fri Jan 10, 2014 11:53 pm
by LC4iOS

Re: Displaying Google Maps (current location) using iPad GPS

Posted: Mon Jan 20, 2014 1:02 pm
by Kevvy
thanks for the replies, I just cant get it working :(

I basically have a rectangle which i want to display the current location via google maps in this rectangle.
I do have a working php page which runs on my web server and displays the current location or location given, but how to let this display live in the rectangle ?

thanks again.


Kevvy.

Re: Displaying Google Maps (current location) using iPad GPS

Posted: Mon Jan 20, 2014 11:07 pm
by LC4iOS
I am thinking the rectangle you are referring to should be the live code browser control

have a look at the sample app in the hyperlink I posted immediately above

Re: Displaying Google Maps (current location) using iPad GPS

Posted: Tue Jan 21, 2014 6:08 am
by Kevvy
LC4iOS wrote:I am thinking the rectangle you are referring to should be the live code browser control

have a look at the sample app in the hyperlink I posted immediately above
Thanks for the reply, I couldn't use that example as the stack would not open. It says that it is corrupted.

Re: Displaying Google Maps (current location) using iPad GPS

Posted: Tue Jan 21, 2014 6:47 am
by LC4iOS
http://ftp.runrev.com/forums/viewtopic. ... 83&p=79766

I'm thinking the mobile objects might not be available in the non-licensed / community versions of LiveCode.

Maybe someone with the 6.5 commercial version of LiveCode would be so kind as to download and try to open.

To test mobile apps on the desktop you have to run it thru the simulator.

To test mobile apps on the device you have to have
1. a licensed version of LiveCode
2. a paid Apple iOS developers membership
3. an incredible amount of patience and time and effort
for stepping thru word by word on step by step procedures
(i've written some recently on this forum)

Re: Displaying Google Maps (current location) using iPad GPS

Posted: Tue Jan 21, 2014 7:21 am
by LC4iOS
LCMaps8ForLC6.5

I copied all the controls from my Licensed LC.5.5.5 over to a new MainStack in Livecode 6.5 Community.

Tested opening in LC 6.5 Community without error.
Have not tested any further as I don't have a LiveCode 6.5 Professional license.

See how you go.

Re: Displaying Google Maps (current location) using iPad GPS

Posted: Tue Jan 21, 2014 8:23 am
by Kevvy
Thanks a mil!!, it is opening on my side now, I will have a look and see if i can get it working on my side.