Android webview resetting after playing fullscreen ad

119 views
Skip to first unread message

Itsbailey X

unread,
Aug 20, 2023, 6:29:17 AM8/20/23
to Google Mobile Ads SDK Developers
When setting the android webview to the html file that's apart of the app and then loading the admob ad the webview will reset and go back to original html file that was set in the MainActivity and if its already on it, it will reload the webpage

so if its `mywebView.loadUrl("file:///android_asset/index.html");` and the user goes to `main.html` and then gets an ad it will go back to index.html and that will also cause any JavaScript code I'm sending to my html file through the callback on rewarded ads not to go through/not reward the player.

If necessary I can provide my MainActivity.java file (it's a mess but it works... Other than the issue I'm having right now)

Mobile Ads SDK Forum Advisor

unread,
Aug 22, 2023, 1:21:37 PM8/22/23
to bailey...@gmail.com, google-adm...@googlegroups.com
Hello,

Could you please elaborate and provide more details on your concern? Are you implementing WebView API for ads (https://developers.google.com/admob/android/webview)?
 
This message is in relation to case "ref:_00D1U1174p._5004Q2o6p7S:ref"

Thanks,
 
Google Logo Mobile Ads SDK Team


Itsbailey X

unread,
Aug 23, 2023, 10:50:55 AM8/23/23
to Google Mobile Ads SDK Developers
When the user receives and ad, no matter what happened, when they close the ad the WebView will reset and go back to the originally set URL or if it's already on it, it will refresh the page. This is unwanted as it causes the rewarded ads not to reward the player for the ad, the callback will evaluate some javascript to reward the player so if the page is the correct one or is loaded in time it will not reward the player and like aforementioned it will put them back the the menu screen each time.

I'm not using the WebView API as the html file itself doesn't show ads and I don't want it too. That being said if I need to then I will but im using the "Google ads mobile SDK".

I hope this helps

Mobile Ads SDK Forum Advisor

unread,
Aug 23, 2023, 2:30:30 PM8/23/23
to bailey...@gmail.com, google-adm...@googlegroups.com
Hello,

Thank you for responding back and confirming that you were using Rewarded ads. For your use case, you will need to check the OnUserEarnedRewardListener to handle the reward events. Sample implementation can be found here: https://developers.google.com/admob/android/rewarded#show_the_ad.

Itsbailey X

unread,
Aug 23, 2023, 4:14:14 PM8/23/23
to Google Mobile Ads SDK Developers
Hi,

Sorry if I've sent this email/message twice now but I cannot see the other one I sent before but I have "OnUserEarnedRewardListener" and when checking logcat it works properly and doesn't throw any errors and evals the JavaScript correctly but it gets rewarded because when the ad is finished the WebView is reset and goes back to the originally set URL and if its already on this URL then it refreshes, this is the same with all other types of ads that go full screen. 

Itsbailey X

unread,
Aug 23, 2023, 11:15:33 PM8/23/23
to Google Mobile Ads SDK Developers
Hello again,

Sorry for all the trouble but it wasn't an issue with the google ads but was because the WebView would reset when the screen was rotated which originally I didn't need to know how to stop this as the game was just meant to be landscape only but I've figured it out now all everything works. Thank you loads

Mobile Ads SDK Forum Advisor

unread,
Aug 24, 2023, 1:55:35 AM8/24/23
to bailey...@gmail.com, google-adm...@googlegroups.com
Hello,

Thank you for updating us. It appears that your issue has been resolved. However, do not hesitate to come back to us should you need further assistance. On the other hand, if you encounter a different issue in the future, kindly open a new thread for better tracking of concerns.

Meixiu Lixiu

unread,
Sep 3, 2023, 12:16:58 PM9/3/23
to Mobile Ads SDK Forum Advisor, bailey...@gmail.com, google-adm...@googlegroups.com


Sent from my iPhone

On Aug 24, 2023, at 5:55 AM, 'Mobile Ads SDK Forum Advisor' via Google Mobile Ads SDK Developers <google-adm...@googlegroups.com> wrote:

 Hello,
--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-admob-ads-sdk/kZ9ol000000000000000000000000000000000000000000000RZVSFX00q5hN1UwlQrK9vbWpi1iEtg%40sfdc.net.

Meixiu Lixiu

unread,
Sep 3, 2023, 12:18:48 PM9/3/23
to Mobile Ads SDK Forum Advisor, bailey...@gmail.com, google-adm...@googlegroups.com

On Aug 24, 2023, at 5:55 AM, 'Mobile Ads SDK Forum Advisor' via Google Mobile Ads SDK Developers <google-adm...@googlegroups.com> wrote:

 Hello,

Mobile Ads SDK Forum Advisor

unread,
Sep 4, 2023, 3:17:04 AM9/4/23
to meixi...@gmail.com, google-adm...@googlegroups.com, bailey...@gmail.com
Hello,

Do you have any concerns related to Mobile Ads SDK? If so, please provide us the details. We'll be happy to assist you.
Reply all
Reply to author
Forward
0 new messages