Corona: Touch Eventlistener on newWebView

Hi

is it possible to add an Touch Eventlistener to a webview??

        touchedwebview = function()

           print ("----- webview is touched !!!")

        end

        webview:addEventListener(“touch”,touchedwebview)

seems it does not work for me, I never get any response

thanks

chris

I don’t think you can, the webviews are not corona groups, they are native objects.

I guess you could try adding the event listener to Runtime and then figuring out if the event coordinates are on top of the web view?

Hi, 

ok nice idea with the Runtime:Addeventlistener

but how exactly what im looking for :slight_smile:

listenall = function( event )        

  print (event.phase)        

  print (event.id)        

  print (event.x)        

  print (event.type)        

  print (event.action)        

  print (event.keyName)        

  print (event.target)        

end

Runtime:addEventListener( “enterFrame”, listenall )

does not give me anything…

You can download inspect.lua from https://github.com/kikito/inspect.lua . Extremely useful little library. 

Put print(inspect(event)) in your event listener. This will spit out everything that the event return gives you. 

Oh you need your device connected to the console to see that print() of course since we’re talking newWebView which means you need to be testing on device. 

Hope this helps.

Hi, its a nice Tool,

but the problem is… as long the webview is on top of all my screen (interstitial ad)

i dont get ANY touch/tap or other ListenerEvent back!!

Any IDeas how to do so

Either that I could recognize a tap on the WebView, or that the content from the webview is empty !

thanks

chris

Oh I see. Its the native objects not letting anything above them issue. I don’t think you’ll find a workaround this. Can you use network.download to attempt to get the size of the web page before opening it in webView? If you use params it reports the size of object being downloaded so perhaps you can find a way to initiate the download, grab the size and then cancel the download and move on with the webView if size is above a threshold. Just an idea. 

thanks for the suggestion.

do u have an idea or bit of example how i would implement that in the applovin.lua

i posted here to share with the community?

http://forums.coronalabs.com/topic/44315-applovin/

would be great

greets

chris

I don’t think you can, the webviews are not corona groups, they are native objects.

I guess you could try adding the event listener to Runtime and then figuring out if the event coordinates are on top of the web view?

Hi, 

ok nice idea with the Runtime:Addeventlistener

but how exactly what im looking for :slight_smile:

listenall = function( event )        

  print (event.phase)        

  print (event.id)        

  print (event.x)        

  print (event.type)        

  print (event.action)        

  print (event.keyName)        

  print (event.target)        

end

Runtime:addEventListener( “enterFrame”, listenall )

does not give me anything…

You can download inspect.lua from https://github.com/kikito/inspect.lua . Extremely useful little library. 

Put print(inspect(event)) in your event listener. This will spit out everything that the event return gives you. 

Oh you need your device connected to the console to see that print() of course since we’re talking newWebView which means you need to be testing on device. 

Hope this helps.

Hi, its a nice Tool,

but the problem is… as long the webview is on top of all my screen (interstitial ad)

i dont get ANY touch/tap or other ListenerEvent back!!

Any IDeas how to do so

Either that I could recognize a tap on the WebView, or that the content from the webview is empty !

thanks

chris

Oh I see. Its the native objects not letting anything above them issue. I don’t think you’ll find a workaround this. Can you use network.download to attempt to get the size of the web page before opening it in webView? If you use params it reports the size of object being downloaded so perhaps you can find a way to initiate the download, grab the size and then cancel the download and move on with the webView if size is above a threshold. Just an idea. 

thanks for the suggestion.

do u have an idea or bit of example how i would implement that in the applovin.lua

i posted here to share with the community?

http://forums.coronalabs.com/topic/44315-applovin/

would be great

greets

chris