Closing a webpopup

Alright gang, got another Android oddity here.
In usual fashion I was slinging away at my iphone / android app which uses some webpopups.
On the iphone side using a simple weblistener with the statement "corona:close" in the string of the HTML works fine for closing a webpopup, but on the Android side, no go!

Anyone else got an idea how to close the webpopup on the Android side?

Can you use native.cancelWebPopup()?

http://developer.anscamobile.com/content/native-ui-features#Removing_the_Web_Popup

The "corona:close" thing isn't really an API to close web popups. The WebOverlay sample app in the Corona SDK uses that string as an example of, essentially, how to pass a message from an HTML page in a web pop-up to the main Corona app. But the string itself doesn't have any effect.

Tim

Tim,
I understand what you are saying - but I'm just passing a parameter in an URL that the listener picks up. It could be any string of characters like "Tims-URL", or "Closeme". Once the webpopup listener sees that string it executes the code below it, which in this case is a shouldload=false.
All that said, the URL catching works fine on the iphone side, I'm using it in one published app already on the iphone side. But using the exact same method it doesn't work on the Android side all of the time.
SOMETIMES it does, but most times I get an Android "Web page not available" error saying it's temporarily unavailable.
Very weird behavior - even for an Android.

Richard

I don't guess there ever went anywhere did it? I'm still trying to work through the bugs of passing a string to a webpopup via the listener but on Android it just doesn't work.

Hi,

I just tested the WebOverlay sample on my Droid and it seems to work as expected. The web overlay appears with the "Close" button, and clicking that button closes the web pop-up.

What build of Corona are you using? What device/OS are you testing on?

Tim

I looked over the code in the example and I'm doing the exact same thing. The only difference I see is the page is loading locally..
My code:

1
2
3
4
5
6
7
--if no errors, then execute my code
        if event.errorMessage == nil then
        if 1 == string.find( url, "corona:close" ) then
        shouldLoad = false
        end
        return true
        end

I tried again this morning to get the close code to work by passing a string in the url to a listener but no go. Again - the weboverlay code is using a local html page and that might be the big difference as I'm loading a remote page from a web server.

More testing -
After some more testing I've determined the Android webpopup is not catching the URL event from the Android side.
I would call it an official "bug".

I've even attempted just to load a simple alert box inside a listener function and still no response. I think the URL never gets passed to the listener or if it does the listener doesn't know how to process it and just ignores it thus throwing the Android web page error "the webpage at "corona:close" might be temporarily down or it may have been moved.

The "corona:close" is just the string I'm passing - I've tried others just to test as well, no matter what the listener function from the webpopup option {urlRequest=mylistener} doesn't work on Android.

Now to try and figure out another Android work-around until Ansca gets to this one..

Some foot notes:
1. It works on iphone no problems.
2. Every once in a while the exact same code WILL close a webpopup on the Android side but I can't determine why it's sporadic, it's only one in every 15 - 20 attempts at closing it.

views:1897 update:2011/10/9 9:57:41
corona forums © 2003-2011