Hi,
my situation is:
– I have a WordPress/JSON API as the backend
– I have a qml app with target android & ios
my goal is:
– I want to show the html output of various advertising providers (like yieldlove or Google Adsense) inside a qml element. I want a qml element like the integration of AdMob.
I tried to do that with the QtWebView component. The rendering and performance is ok, but I can’t disable the default touch functionality. When I swipe down and I came over the webview element, of course it tries to scroll down.
If I set the parameter “enabled” to false, it only works on desktop. On iOS this parameter is ignored. This is my start how I tried to implement what I want:
WebView {
id: adWebView
anchors.fill: parent
url: adWebView.enabled ? padUrl : ""
z:0
onLoadingChanged: {
// WebViewLoadRequest loadRequest
if(loadRequest.status == WebView.LoadStartedStatus){
adWebView.enabled = true;
} else if(loadRequest.status == WebView.LoadSucceededStatus){
if(adWebView.loadProgress == 100 || adWebView.loadProgress == 0){
// determine height of ad element to change webview height
adWebView.runJavaScript("document.getElementById('site-container').clientHeight", function(height){
// adjust webview height
adRect.height = height;
// disable webview for swipescroll experience
adWebView.enabled = false;
// find external a tags
adWebView.runJavaScript("document.getElementById('site-container').getElementsByTagName('a')[0].href", function(url){
console.log("--> add external url", url);
if( typeof url !== 'undefined' ){
adRect.adtarget = url;
}
});
});
}
} else if(loadRequest.status == WebView.LoadFailedStatus){
adWebView.enabled = false;
}
}
}
I want to see the implementation of AdMob. It renders a small banner at the bottom of the app screen. Do anybody know how to do that? In fact I want something like that, but inside a listview as a listelement.
Thanks for your help!
Arne