Can I launch Android browser within LiveCode Card - Solved

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Can I launch Android browser within LiveCode Card - Solved

Post by DR White » Sun Jun 08, 2014 3:12 pm

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
Last edited by DR White on Wed Jun 11, 2014 1:31 am, edited 2 times in total.

sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

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

Post by sefrojones » Sun Jun 08, 2014 8:04 pm

Check out the androidBrowser object in the dictionary :)

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

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

Post by DR White » Sun Jun 08, 2014 8:58 pm

I tried, but I could not get it to work.

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

Thanks,

David

sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

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

Post by sefrojones » Sun Jun 08, 2014 9:03 pm

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

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

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

Post by DR White » Sun Jun 08, 2014 10:05 pm

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,

sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

Re: Can I launch Android internet browser within LiveCode Ca

Post by sefrojones » Mon Jun 09, 2014 4:06 am

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.

sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

Re: Can I launch Android internet browser within LiveCode Ca

Post by sefrojones » Mon Jun 09, 2014 5:53 am

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

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

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

Post by DR White » Mon Jun 09, 2014 10:33 pm

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

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Re: Can I launch Android internet browser within LiveCode Ca

Post by DR White » Mon Jun 09, 2014 11:34 pm

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

sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

Re: Can I launch Android internet browser within LiveCode Ca

Post by sefrojones » Mon Jun 09, 2014 11:47 pm

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

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Re: Can I launch Android internet browser within LiveCode Ca

Post by DR White » Mon Jun 09, 2014 11:58 pm

Thank You so MUCH Sefro!!

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

sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

Re: Can I launch Android internet browser within LiveCode Ca

Post by sefrojones » Tue Jun 10, 2014 1:09 am

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

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Re: Can I launch Android internet browser within LiveCode Ca

Post by DR White » Tue Jun 10, 2014 2:12 am

If it is challenging for you, It would be impossible for me.

Thank You so much for your time and effort,

David

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Can I launch Android internet browser within LiveCode Ca

Post by Simon » Tue Jun 10, 2014 3:29 am

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Re: Can I launch Android internet browser within LiveCode Ca

Post by DR White » Tue Jun 10, 2014 10:12 am

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

Post Reply