Appodeal init causes lag!

Hello!

I have tried to use the Appodeal plugin to display ads in my game. Sadly, the init() function causes lag every time for around 5-7 seconds after its call.

I have tried different Corona Builds and always get the same problem. I have contacted Appodeal support and they urged me to disable “auto-cache”, but that is not possible with the plugin.

I also get a lag when displaying banners from Appodeal, even if they are mediated AdMob banners, while the AdMob plugin for Corona does not cause any problem at all.

I am using Android 6.

Do you have any idea what the problem might be? I am thankful for any help!

Greetings,

Nico

Do you see any errors in the logs. I don’t have an Android 6 device, but I have tested it as far as 5.1.1 and no lag. Can you test it on an older version of Android and see if you have the same issue? Where have you placed the init call?

Adrian

Hi Adrian,

I don’t see any errors on the log. I sometimes saw that while the init function is running there was an error loading a banner, but nothing else, and that problem was very seldom.

I have placed the init call very early in the main.lua, so that it gets called right at the start of the app, and it has time to load. Sadly, it still lags after some seconds, causing the animations in the Main Menu to look very bad.

I don’t have access to a device with an older Android version, but it should work fine with Android 6, since that is still a huge part of the customer base, and I have tried it on 2 other devices with Android 6 both compiling with different Corona and different Java JDK versions and the problem stayed.

Are there any known bugs in the fairly new Appodeal Plugin? The documentation does not give a lot of information about the way the plugin works…

I have had only a couple issues with Appodeal and all have very easy workarounds.

On iOS: You can’t use certain plugins since Appodeal already has them (flurry and play services to name 2).

On Amazon: I had to include the Applovin plugin (i am not using it). Not sure why this is the case but without it I never get the rewardedVideo callback and banner ads don’t always show up.

Other than that 100% fill rate and on iOS you can even add SDK less mediation (like Smaato) to the Admob side.

Not sure how you do it, but i wait for the system events:

local function systemEvents( event ) if ( event.type == "applicationSuspend" ) then elseif ( event.type == "applicationResume" ) then elseif ( event.type == "applicationExit" ) then elseif ( event.type == "applicationStart" ) then if system.getInfo("targetAppStore") == "apple" then appodeal.init( adListener, { appKey="mykey" } ) elseif system.getInfo("targetAppStore") == "amazon" then appodeal.init( adListener, { appKey="mykey" } ) -- Initialize the AppLovin plugin applovin.init( loveListener, { sdkKey="mykey" } ) else appodeal.init( adListener, { appKey="mykey" } ) end return true end Runtime:addEventListener( "system", systemEvents )

Hi Adrian,

I have tried Appodeal on Android 6 now with 2 very simple Corona Projects and both of them start to lag, when the init() function gets called. This also happens on other phones with Android 6, and every tested phone is a high-end product.

So I suppose the problem is Android 6 now. Do you know how to contact the Appodeal plugin developer? I would like to ask him or her to debug the plugin on Android 6. I would do this myself if I could, but sadly, I do not have access to the source-code.

Hey Nico.

Could you please make a small test case that exhibits this behavior and file a bug here please?: https://developer.coronalabs.com/content/bug-submission

Thank you

Since I last wrote on this thread I bought a 6.0.1 ZTE device (cheap pos) and had the opportunity to play with a Galaxy S6 with 6.0.1. I did not experience any lag on either of these devices with my app.

The lag is only noticeable when you see animations in the game (they start to stutter). Did you try to implement the Appodeal Plugin in - for example - one of the physics sample projects provided by Corona? I could clearly see the physics stuttering for the first 5-7 seconds after the start of the app (where I call the init() function of the Appodeal Plugin).

Hey Nico.

I noticed in your sample app that you are also calling .show() after the init event, so this isn’t actually an issue with the init call. The slowdown happens when the banner ad is on screen.

This is a common occurrence with banner ads (especially animated banner ads). They consume a lot of CPU power and that is why most providers explicitly state in their best practises guides to not use banner ads during gameplay.

They advise that banner ads should be shown in places like menus, end of level screens, pause menus and so on.

I would also advise that you call init() as soon as possible so you have ads available (cached) as needed.

For best performance on Android 6.x devices, you should also request the write external storage permission via the native.showPopup() api: https://docs.coronalabs.com/daily/api/library/native/showPopup.html#requestapppermission - That allows the ads to be cached on the device, rather than streaming on demand.

Thanks

Hi Danny,

have you tried to remove the show() function, so that you just have the init() function? Yes, the banner causes lag,  but the init() function alone causes lag as well for me.

Greetings

I have indeed Nico. 

I did not notice much lag at all. Possibly a second or two at most.

Again, init() should not be called during gameplay for any ad plugin that caches ads for you automatically. It should be called as soon as possible after starting your app so it has pulled down and cached the ads it needs to function before you start your game.

Be sure to request access to the permission I stated above also, otherwise ads won’t be able to be cached on disk and will therefore result in more CPU consumption.

Native developers would also experience the same thing with ad providers of this nature. 

Hello Danny,

I am sorry to tell you, but I did notice lag the first 5-7 seconds, not 1-2… And I know that you have to call the init() early in the game, this is why I have included a splash screen, since the main menu already has animations. This works fine for other Ad Plugins but I cannot extend the splash screen to such durations because of Appodeal alone.

Please try to make the init() faster in any way. It works with the other Ad Plugins as well…

Hello Nico.

There isn’t anything we can do to make init() faster. Appodeal isn’t like other Ad plugins, it has a lot more work to do during its initialisation process (the Appodeal SDK initialisation process, not our plugins init() function) than other plugins.

If we disable caching for Appodeal, then you will just be shifting the loading process from startup to when you want to show the ad.

This also goes against their recommended implementation. 

My point is that we aren’t doing anything extra that could cause this, we are simply calling the Appodeal SDK methods that have to be called during its initialisation. 

Hello Danny,

what about disabling caching and implementing a load() functions like many other ad plugins have one, so that you can decide yourself when to load the ads (preferably during an in-game loading screen, or a static part with no animations)?

The reasons this wasn’t implemented are:

  1. Their docs state their best practise is to let them handle ad loading for maximum impressions/revenue.

  2. Disabling caching and manually loading ads simply did not work during my testing of that feature during development

Thank you

Do you see any errors in the logs. I don’t have an Android 6 device, but I have tested it as far as 5.1.1 and no lag. Can you test it on an older version of Android and see if you have the same issue? Where have you placed the init call?

Adrian

Hi Adrian,

I don’t see any errors on the log. I sometimes saw that while the init function is running there was an error loading a banner, but nothing else, and that problem was very seldom.

I have placed the init call very early in the main.lua, so that it gets called right at the start of the app, and it has time to load. Sadly, it still lags after some seconds, causing the animations in the Main Menu to look very bad.

I don’t have access to a device with an older Android version, but it should work fine with Android 6, since that is still a huge part of the customer base, and I have tried it on 2 other devices with Android 6 both compiling with different Corona and different Java JDK versions and the problem stayed.

Are there any known bugs in the fairly new Appodeal Plugin? The documentation does not give a lot of information about the way the plugin works…

I have had only a couple issues with Appodeal and all have very easy workarounds.

On iOS: You can’t use certain plugins since Appodeal already has them (flurry and play services to name 2).

On Amazon: I had to include the Applovin plugin (i am not using it). Not sure why this is the case but without it I never get the rewardedVideo callback and banner ads don’t always show up.

Other than that 100% fill rate and on iOS you can even add SDK less mediation (like Smaato) to the Admob side.

Not sure how you do it, but i wait for the system events:

local function systemEvents( event ) if ( event.type == "applicationSuspend" ) then elseif ( event.type == "applicationResume" ) then elseif ( event.type == "applicationExit" ) then elseif ( event.type == "applicationStart" ) then if system.getInfo("targetAppStore") == "apple" then appodeal.init( adListener, { appKey="mykey" } ) elseif system.getInfo("targetAppStore") == "amazon" then appodeal.init( adListener, { appKey="mykey" } ) -- Initialize the AppLovin plugin applovin.init( loveListener, { sdkKey="mykey" } ) else appodeal.init( adListener, { appKey="mykey" } ) end return true end Runtime:addEventListener( "system", systemEvents )

Hi Adrian,

I have tried Appodeal on Android 6 now with 2 very simple Corona Projects and both of them start to lag, when the init() function gets called. This also happens on other phones with Android 6, and every tested phone is a high-end product.

So I suppose the problem is Android 6 now. Do you know how to contact the Appodeal plugin developer? I would like to ask him or her to debug the plugin on Android 6. I would do this myself if I could, but sadly, I do not have access to the source-code.

Hey Nico.

Could you please make a small test case that exhibits this behavior and file a bug here please?: https://developer.coronalabs.com/content/bug-submission

Thank you