Page 1 of 1

Displaying Web Pages

Posted: Mon Feb 27, 2012 11:58 pm
by Gene
I made a rash assumption (again) that LC for Android can display web pages. It appears that this is normally done with RevBrowser, which is not available for Android yet. One post referred to do this by "linking" to the user's native browser and passing the URL to that, which I don't don't know how to do. Is anybody displaying web pages in their Android apps, and how so?

Thanks much - Gene

Re: Displaying Web Pages

Posted: Tue Feb 28, 2012 12:26 am
by Mark
Hi Gene,

The only way to display an internet page on Android is by using the launch command:

Code: Select all

launch URL "http://www.android.com"
This opens the website in the Android browser.

Kind regards,

Mark

Re: Displaying Web Pages

Posted: Tue Feb 28, 2012 5:38 am
by Gene
Thank you Mark!! I don't know how I missed the launch command, because I thought I scoured the docs and the forums pretty thoroughly. Must be getting blind, I guess.

Not only does the launch URL bring up web pages from LC Android just fine, but I also dug dug up what Google calls "Static Maps API," All you have to do is launch the base URL with parameters of your choice (that are supplied in an example), and you have a map with a pin in it displayed in your browser. Now, two of the parameters (surprise) are the latitude and longitude of the pin, so then you just convert your current position Lat/Lon from the GPS to a couple of variables, insert them in the string, and now you have an on demand current position location map in your app!

Displaying the map in the browser from the app works just fine with a predefined string of parameters. Tomorrow I'll create a test program to insert the real time GPS output as variables into the string to send to the maps URL to make sure that works, but that's pretty basic.

The next holy grail is a moving map that tracks real-time movement. Google offers other API's that look like they serve this function, but I'm pretty sure they require at least the ability use java to communicate the Lat/Lon and other variables to the moving map. My sense is that it can be done with LC, but I think there is a learning curve associated with that step.

Thanks again, Gene

Re: Displaying Web Pages

Posted: Tue Feb 28, 2012 5:53 am
by Jellicle
I wouldn't be surprised if LC adds native browser controls for Android at some point - currently the platform lags way behind iOS in regards to native controls.

And on iOS at least you can already use all the Google Maps API Java stuff...I haven't done live updating of location but I've done pretty much everything else, and it works fine...if a bit slow.

Gerry

Re: Displaying Web Pages

Posted: Tue Feb 28, 2012 5:44 pm
by Gene
Jellicle wrote:I wouldn't be surprised if LC adds native browser controls for Android at some point - currently the platform lags way behind iOS in regards to native controls.

And on iOS at least you can already use all the Google Maps API Java stuff...I haven't done live updating of location but I've done pretty much everything else, and it works fine...if a bit slow.

Gerry
There is a note in the latest release notes for Android that says that a future release will have "a substitute mechanicsm" for RevBrowser. I would suppose that whatever functionality the substitue mechanism has, the coding will correspond to RevBrowser for iOS, or you would have to code differently for each platform. In that case, LIveCode would not be cross platfrom for Anbdroid and iOS with regard to browswer control.

Re: Displaying Web Pages

Posted: Sun Mar 04, 2012 5:06 am
by BarrySumpter
Hi Gene,

I'd be very interested in knowing how to retrieve GPS info on android.

tia

Re: Displaying Web Pages

Posted: Sun Mar 04, 2012 5:27 am
by Jellicle
BarrySumpter wrote:I'd be very interested in knowing how to retrieve GPS info on android.
Check the Android release notes, page 20. After starting tracking with mobileStartTrackingLocation you call mobileCurrentLocation().

Gerry

Re: Displaying Web Pages

Posted: Sun Mar 04, 2012 5:32 am
by BarrySumpter
Jellicle wrote:
BarrySumpter wrote:I'd be very interested in knowing how to retrieve GPS info on android.
Check the Android release notes, page 20. After starting tracking with mobileStartTrackingLocation you call mobileCurrentLocation().

Gerry
Hi Gerry,
Many thanks.
What Version of LC and/or android deployment pack?

Re: Displaying Web Pages

Posted: Sun Mar 04, 2012 8:09 am
by Jellicle
Whoops. I didn't realise I had a pre-release version open when I checked that *blush*.

Gerry

Re: Displaying Web Pages

Posted: Sun Mar 04, 2012 8:13 am
by BarrySumpter
No Prob.
Just checking.

Re: Displaying Web Pages

Posted: Tue Mar 06, 2012 9:20 am
by Simon Knight
Hi,

Did you realise that you may display a google static map inside a LC app on android (or any where else) by using a standard LC image well. Just set the file parameter to the google static maps URL and the image will display the map. Google imposes some limits on its free service - max size is 640 by 640 and no more than 1000 map images in 24 hours. Within these limits its possible to create a quasi moving map by updating the image every so often.

Simon

Re: Displaying Web Pages

Posted: Tue Mar 06, 2012 10:46 am
by BarrySumpter
1 map refresh every 1.44 mins.
calcs like plenty.

Re: Displaying Web Pages

Posted: Tue Mar 06, 2012 11:00 am
by Simon Knight
1000 maps per day and 1440 mins per day = 1 map every 1.4 mins. :)

but

"calcs like plenty" :?:

My Andriod app refuses to display the google image that indicates you have used to many maps - its fine on desktop though - odd.

Simon

Re: Displaying Web Pages

Posted: Tue Mar 06, 2012 1:39 pm
by BarrySumpter
Maybe trap the message and display your own graphic?