Admob changed recently and I can't find some reliable resources on how to load interstitial ads. I have managed to load ads inside the main activity but I need the ad to be loaded between levels. The structure is like this: main activity -> android application -> levels. I tried to show ads by calling a method from the main app but I got an error telling me to perform this task on the UI thread. How can you show ads from inside other classes not from the main activity? On the other hand I received "os_unix.c:30247" error and cannot open file at line 30247 of [00bb9c9ce4] although when the ad loaded on the main activity it worked. This is not duplicate because other questions I have found on this topic refer to legacy admob: now interstitial ads can be loaded and shown without using views.
1 Answers
2
votes
You can load/display interstitial ads in a worker/non-UI thread by using the Activity.runOnUiThread() method. To show ads from inside other classes not from the main activity you need to use a facade.
Follow this libgdx official guide. It covers both banner and interstitial ads and it isn't outdated. It uses the new admob via the google play services.