- Home /
Prioritize actions to avoid lags (Android+iOS)
Hi guys,
I want to know if you got any hints on how to manage the internet connection for ads or any other requests with your game on mobile games. I found that when my ads (iAd, RevMob, AdMob, etc) is connecting to their server with a low wifi connection speed (seems to be more frequent on iphone 4 and nexus s), my games have huges lags. I know I could wait until the connection is finished, but sometimes it is really long, so I can't "block" the game till the connection is done.
How are you managing this. All games I'm playing on mobile seem to not have this problem. There is maybe something I don't know yet. I'm sure it's the connection that is dropping down performance because all my games running fine without internet connection. Unfortunately if the new user play the game and it lags because of his connection (or the server response speed), the user usually will put a one star review and delete the game. All plugins doesn't have a Timeout.
Thank in advance, sorry for my english
David
Edit: In fact, what I want to know is, is there a way to prioritize actions on the cpu. Example, put my fetching data script in a lower priority than my games scripts..I'm not talking about script order. I don't care if my connection to the ads take twice longer to accomplish than it should, I only want to be sure that this connection won't affect the others more importants scripts. I'm maybe confusing you all because I'm trying to explain what I want in "english".
Answer by Sisso · Feb 26, 2014 at 12:19 AM
You need to download your data before its needed. For example, when your app start download and hold the ads, when show it, download next. On this way the user never will need to wait.
I only know flurry api, and you can achieve this with something like it:
void NerdFlurry_fetchAds() {
UIWindow *window = [UIApplication sharedApplication].keyWindow;
UIViewController* controller = window.rootViewController;
[FlurryAds fetchAdForSpace:@"Candy Flappy Angry Run" frame:controller.view.frame size:FULLSCREEN];
}
Thanks for the answer, but I'll edit my question to be more precise on what I want.