Page 1 of 2

Can I launch Android browser within LiveCode Card - Solved

Posted: Sun Jun 08, 2014 3:12 pm
by DR White
I have a need for an android app that I can control the background graphics, while downloading an audio file to the Android Sound Player.

Can I launch the internet browser within a LiveCode Card?

or after a period of time at the website come back to liveCode app?

Thanks,

David

Re: Can I launch the internet browser within a LiveCode Card

Posted: Sun Jun 08, 2014 8:04 pm
by sefrojones
Check out the androidBrowser object in the dictionary :)

Re: Can I launch the internet browser within a LiveCode Card

Posted: Sun Jun 08, 2014 8:58 pm
by DR White
I tried, but I could not get it to work.

Could you give me an example of how to use it?

Thanks,

David

Re: Can I launch the internet browser within a LiveCode Card

Posted: Sun Jun 08, 2014 9:03 pm
by sefrojones
I'm heading out the door right now, but have a look at this lesson:

http://lessons.runrev.com/m/4069/l/2283 ... er-control


keep in mind that the mobile browser is a native control, so it will not work in the development environment. Also make sure you have internet checked in your standalone settings. I'll be back in a few hours, if you're still having trouble I'll try to help :)

--Sefro

Re: Can I launch the internet browser within a LiveCode Card

Posted: Sun Jun 08, 2014 10:05 pm
by DR White
That was the perfect simple example, but it will not compile. I shows that it complied successfully, but when I go to the new directory, there is no file!

Can you get the sample stack to run on your machine? I am using Windows 7.


Thanks,

Re: Can I launch Android internet browser within LiveCode Ca

Posted: Mon Jun 09, 2014 4:06 am
by sefrojones
I just tried to save the example as a standalone, and the folder was empty here as well. I Tried on a couple different versions of LCcwith the same result......It could be a bug. I'll do few more tests, and see what I can come up with.

Re: Can I launch Android internet browser within LiveCode Ca

Posted: Mon Jun 09, 2014 5:53 am
by sefrojones
I'm Still not sure why the example from the tutorial will not compile into a standalone, but I did a quick test of the mobile browser on android, and it's working as expected.

1. Create a new stack.

2. Drag out a rectangle graphic and resize it to fill the stack

3. Group the rectangle and name the group "browser"

4.Add this code to your card:

Code: Select all

on preOpenCard
    mobileControlCreate "browser"
    put the result into sBrowserId
    mobileControlSet sBrowserId, "rect", the rect of group "Browser"
    mobileControlSet sBrowserId, "visible", "true"
    mobileControlSet sBrowserId, "url", "http://forums.livecode.com"
end preOpenCard


on closeCard
mobileControlDelete sBrowserId
end closeCard
5. and this to your stack:

Code: Select all

on preopenstack
set the fullscreenmode of this stack to "exactfit"
end preopenstack
6. Set up your standalone settings for android, make sure "internet" is checked.

7. Test

It seems to be working here Win7 64bit. Hope this helps!

--Sefro

Re: Can I launch Android internet browser within LiveCode-So

Posted: Mon Jun 09, 2014 10:33 pm
by DR White
Sefro,

That works GREAT! :D

I hope I can figure out exactly how it works, so I can create the interface I need.

Thanks SOO Much, :D


David

Re: Can I launch Android internet browser within LiveCode Ca

Posted: Mon Jun 09, 2014 11:34 pm
by DR White
Could you give me just a little more help?

Now that I can get to the desired website with the LC Android browser, When I click on the mp3 file link at the site nothings happens.

What do I need to do to hear the website audio mp3 file when I select it?

Thanks,

David

Re: Can I launch Android internet browser within LiveCode Ca

Posted: Mon Jun 09, 2014 11:47 pm
by sefrojones
I'm not too sure,I've never tried to get audio from a website with the browser, but if you'd care to share the website that you're trying to display/ play music from I'd be happy to give it a try.

--sefro

Re: Can I launch Android internet browser within LiveCode Ca

Posted: Mon Jun 09, 2014 11:58 pm
by DR White
Thank You so MUCH Sefro!!

The web page is http://covingtongoodnews.com/audio-downloads/

Re: Can I launch Android internet browser within LiveCode Ca

Posted: Tue Jun 10, 2014 1:09 am
by sefrojones
I tested the website you linked to using the same basic code I posted earlier. I was able to click on a date and have it played in an android player in the emulator. I tried the same exact stack on a physical device, and pressing the link does nothing. I'm not sure why this is, but I will keep messing with it. Anybody else have any ideas?

--Sefro

Re: Can I launch Android internet browser within LiveCode Ca

Posted: Tue Jun 10, 2014 2:12 am
by DR White
If it is challenging for you, It would be impossible for me.

Thank You so much for your time and effort,

David

Re: Can I launch Android internet browser within LiveCode Ca

Posted: Tue Jun 10, 2014 3:29 am
by Simon
Hi David,
If you wanted it to stream then skip this posting.
Using Mobile Browser Example.livecode and changing this:

Code: Select all

on browserStartedLoading pUrl
   put "Started loading:" && pUrl into field "Status"
   if ".mp3" is in pUrl then
      put url pUrl  into url("binfile:" & specialFolderPath("documents") & "/my.mp3")
      put specialFolderPath("documents") & "/my.mp3" into tPath
      mobilePlaySoundOnChannel tPath, "current", "now"
   end if
end browserStartedLoading
Does work. The files take about a minute to download so you may want to show a clear message.

Simon
Edit: You should probably change that if conditional to:

Code: Select all

  if char -4 to -1 of pUrl = ".mp3" then

Re: Can I launch Android internet browser within LiveCode Ca

Posted: Tue Jun 10, 2014 10:12 am
by DR White
Simon,

Now that I can get to the desired website with the LC Android browser, When I click on the mp3 file link at the site nothings happens.

I wanted it to play when I clicked on website file linked text, if possible.

Thanks,

David