overwolf.games.onGameInfoUpdated event is not firing when playing League. As a result, the ad is not being removed because the app doesn’t know when the game is in focus.
Can you reproduce it (exact steps to reproduce):
overwolf.games.onGameInfoUpdate.addListener(console.log) to the Chrome console
- launch any game other than League
- See event logged out in the console when alt-tabbing in and out of game
- Launch League
- The events are not logged out when alt-tabbing in and out of game.
Impact for my app: The ad doesn’t get removed when playing League
Overwolf version: 0.215.0.1
LoL no onGameInfoUpdated until close OverwolfLogs_2022-12-16_09-45-09.zip (1.5 MB)
In Apps/Insights Capture/desktop.html.log, I log out the
gameInfo from the
At line 50, I open Osu!.
Line 51, focusChanged and the game is in focus.
Line 79, I alt-tab and game loses focus.
Line 84, I atl-tab back into the game. The game is in focus.
Line 111, I close the game. Osu! loses focus on 112 and is closed on 114.
At line 136, I start League of Legends.
Line 138, the game is focused after launch.
In between 158 and 280, I alt-tab a few time between the game and Chrome and the game and the desktop window. There isn’t any event logged out saying the focus was changed.
Line 281, I close League. The game loses focus on line 282 and is closed on 284.
I was playing a custom game in League with just myself and no bots.
So, there are a few things at play here. I will assume from here on out that you are on windowed borderless, as this does in fact reproduce with that setting:
1 - Detecting that the game lost focus. It is correct that onGameInfoChanged will not fire in this case, as, if you look at the game, you’ll see that the game still thinks it is in focus the entire time (if that makes sense). As a result, while it might be a little counter-intuitive, it does make sense with the current spec of things (this is also why apps stay in “overlay” mode for league even when alt-tabbing).
2 - Reasons for detecting it. It is true that detecting that the game lost focus is useful, and this technically can be done. However, I don’t think you actually need that for this particular use-case. The reason is simple - You don’t actually need to remove the Ad manually in this case. More specifically - if it is an in-game window, the new Ads SDK should be able to manage the Ad for you automatically. If you do find yourself needing to detect a loss of focus for something else, do feel free to convert this to a feature request for that.
Hope that helps!
The ads are running in “desktop_only” windows.
Rotem was reviewing our app and has pointed out that the ads are not being removed when goes back to the game window.
Despite seeing in some slack threads saying that the ads will handle removing themselves in some Slack threads, the ads do not remove themselves when going back into game. I had to changed our implementation to call the
removeAdImpl API to handle the refresh and removal of the ads.
removeAd don’t do anything in the new ad SDK as far as I can tell.
After using the new
removedAdImpl API calls, Rotem was still running into the issue where the ads were not being removed when going back into game despite it working when I tested it. I found that only League, which Rotem was using to test our ad fix, doesn’t fire the event for focusing the game window.
Previously, League will fire this event. i.e., the ads were being removed when Rotem tested our app in the past.
Is it possible to restore this feature? I don’t think there is any other way to determine when a game as been focused and every other game I tested has this feature.
If you need more details, check out the insights_gg channel in Slack.