native browser

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
colourpixels
Posts: 83
Joined: Mon Oct 31, 2011 5:28 am

native browser

Post by colourpixels » Mon Jun 25, 2012 1:50 am

Hi All,
Looking through the Android release notes it seems like a browser control should be easy enough to create (I've already got an iPhone version of my app running, just trying to make an Android version now).
I've got an on card open script as follows:

Code: Select all

on preOpenCard
   if the environment is not "mobile" then
      exit preOpenCard
   end if

   -- Create our browser control and store the id
   mobileControlCreate "browser"
   put the result into sBrowserId

   -- Native controls start off invisible
   mobilecontrolset sBrowserId, "visible", "true"
   
   -- Set up a suitable initial url
   mobilecontroldo sBrowserId, "load", "http://www.google.com"
   
   -- Make sure everything is the right size
   resizeStack
end preOpenCard
All I get is a black screen in the emulator though. Anybody got any tips?

Many thanks

Dale

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: native browser

Post by sturgis » Mon Jun 25, 2012 3:37 am

In your resize handler you are doing a mobilecontrolset sbrowserid,"rect","0,50,200,250" right? (with your own numbers of course)

I managed to get it working in the emulator as well as on a device (kindle fire). can you post your resize script?

I did notice that I just can't get mobilecontroldo sbrowserID,"load" to work reload works, i'm sure the others do but load just seems to do nothing.
So i'm using mobilecontrolset sBrowserId,"url","http://www.google.com"

EDIT: IF I understand the dictionary entry, mobilecontroldo used with "load" is for pushing your own html into the browser. Tried it that way and it works fine.

mobilecontrold sBrowserId,"load","http://somebaseurl","<H1>This is a test</h1>"

colourpixels
Posts: 83
Joined: Mon Oct 31, 2011 5:28 am

Re: native browser

Post by colourpixels » Mon Jun 25, 2012 5:28 am

Awesome thanks for the reply. I'll give the url command a try and see how I go. At the moment, my virtual device seems to be broken, I can't even get a hello world app to load anymore (and not sure at which point it broke).

Any chance you could post the Android VDM settings you're using and the corresponding standalone application settings?

Thanks again

Dale

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: native browser

Post by sturgis » Mon Jun 25, 2012 11:33 am

The target is android 2.3.3 api level 10,
arm of course
sd card 10 MiB (I'm not worried about external storage use yet)

snapshot is not turned on.
Skin, using built-in wvga800

which means hardware is:
abstracted density 240
max vm application heap size 24
device ram size 256

On startup my options are limited (since i'm not using snapshots) scale display to real size is not selected. Sometimes I will choose Wipe user data.

I also never try and test anything with less than 2.3 (I think its just me but I had some trouble getting 2.2 to work when I was just starting with android.. Surely something I was doing but.. When I tried 2.3+ I got things to work. Plus my devices are all 2.3.3 and up.)

While I doubt it will have an affect (like I said i'm sure it was ME causing the problems when trying with 2.2) if nothing else it wouldn't hurt to try an alternative to whatever platform level you're using now.

colourpixels
Posts: 83
Joined: Mon Oct 31, 2011 5:28 am

Re: native browser

Post by colourpixels » Thu Jun 28, 2012 8:16 am

Many thanks that all worked a treat, it was the lower version that was killing it. "url" also worked, so all is cool.

Thanks again for your help, it was greatly appreciated.

Cheers
Dale

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: native browser

Post by jacque » Fri Jun 29, 2012 6:13 am

Ian from the RR team helped me with the black screen problem today here at the conference. For me, anything launched in 2.2 Android emulation opened all black, though 2.3 worked fine. It turns out that I had all sensors turned on for that particular emulator image. When Ian turned off all sensors and restarted the 2.2 emulator image, it worked again. Since the emulator can't use any sensor info, you aren't missing anything by turning them all off.

It was a real treat to watch Ian debug it. He sure knows his way around Android and the terminal.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply