Hey everyone
I have create a Corona app that uses the tab bar at the bottom of the app. But then I have so much stuff that must rely on serverside so I decided to create webviews for all tabs and the only thing I do is that I send in the DEVICE ID on all requests so I know which client/device is requesting the data.
This works great and here is the code for it.
[lua]native.showWebPopup( 0, 0, 320, 436,
“http://servername/mobile/displayInfopage?uid=” … deviceID)[/lua]
But now when I created a mobile webpage with links on it to tel, sms and mailto the only one worked was tel. So I decided to dig into this a lot and I didn’t find any post on how to actually solve this in some smart and neat way.
Today I did solve it though and I thought I would share it with you.
When calling the showWebPopup you can add a listener to that call that will actually get called on all clicks and urls clicked on in every webpage you load inside the webview.
So I created a little listener that will take the url on this particular page and instead of trying to open them in the webpopup I use the System.openURL and VOILA all of them works perfectly.
Complete code sample below
[lua] local function listener( event )
local shouldLoad = true
local url = event.url
system.openURL( url )
return shouldLoad
end
native.showWebPopup( 0, 0, 320, 436,
“http://servername/mobile/displayInfopage?uid=” … deviceID,
{urlRequest=listener} )[/lua]
and in the mobile webpage on the server which is opened above I can now call mailto, tel or sms and it will open and prefill in the case that works with no problems.
The only thing that irritates me a bit is that I would like to return to my app after sending the sms is done or after the mail get sent but I haven’t been able to solve this just yet.
Have fun! [import]uid: 22737 topic_id: 18446 reply_id: 318446[/import]
I just went so happy when solving this issue. [import]uid: 22737 topic_id: 18446 reply_id: 71435[/import]