Hi Guys,
I’ve created a game that uses AdMob to show interstitial ads between screenswitches.
When my app starts up it first shows my logosplash screen -> then switches screen and show an app (when there is an internet connection and if not) -> then switches screen to show my games Title screen.
Now when i turn off the wifi connection on my android device it all works perfect.
I’ve added this method to my AndroidLauncher to check for network connection:
@Override
public boolean isNetworkConnected() {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo ni = cm.getActiveNetworkInfo();
if (ni == null) {
// There are no active networks.
return false;
} else
return true;
}
which gets called from within my logoSplashScreen class to check if my device is connected to the Network and either display the interstitial ad or not, with this piece of code:
if (switchScreen) {
if (game.getAdsController().isNetworkConnected() == true) {
game.getAdsController().showInterstitialAd(new Runnable() {
@Override
public void run() {
game.setScreen(game.titleScreen);
}
});
} else {
game.setScreen(game.titleScreen);
}
}
Now what happens is that (too) occasionally my app freezes up when there IS a network connection at the time my logo faded out and it needs to switch from the logoSplashScreen to show the Interstitial ad.
I’m not sure what’s going wrong and how to solve this.
Anyone experience with this?