How to block google adsense ads in android webview? I have an adsense enabled website and I am creating android webview app for that website. How to block adsense adss in that webview app? please help. Thanks in advance!
Asked
Active
Viewed 1,222 times
2 Answers
0
Follow this: Set your custom user-agent to your webview and display "Show advertisements "," Hide advertisements " options on your fron-end based on google.com.ua/… or Pass mobile_app=1 in URL When website open through webview, Then catch mobile_app=1 through GET method in website, Write code in website: if($_GET['mobile_app'] != 1) {// ads of Google}
Amin Pinjari
- 1,926
- 2
- 23
- 52
-
How to pass mobile_app=1 in url and where I use the Get method. Please expllain – Sintu Cr Sep 14 '17 at 13:01
-
http://www.example.com/? Consider this as your url then add one paramter to this url like this: http://www.example.com/?is_webview=1 Add your server side this code if GET [is_webview] == 1 store is_webview in session, or cookie endif if SESSION [is_webview] != 1 echo ADSENSE_CODE endif – Amin Pinjari Sep 14 '17 at 13:26
0
try to intercept and block the ads url using the callback shouldOverrideUrlLoading and shouldInterceptRequest .
Ganesh Shinde
- 1
- 3
-
-
public boolean shouldOverrideUrlLoading (WebView view, String url) { if (url.equals("ads url")) { return true ; } } – Ganesh Shinde Sep 14 '17 at 14:13
-