How to properly 'destroy' or 'reset' the IMA Android SDK?

940 views
Skip to first unread message

r...@jwplayer.com

unread,
Feb 12, 2016, 5:07:17 AM2/12/16
to Interactive Media Ads SDK, Paul Mandal
Hi,

In our video player for Android we allow developers to load another video while IMA is playing advertisements. When a developer does that, we want to destroy the current AdsManager, and everything related to it, so that IMA SDK does not send out events anymore that try to control our video player.

According to the documentation AdsManager.destroy() does exactly what we want, however I noticed that after a call to destroy() and nulling out the AdsManager we still receive events from the SDK when the new video is already loaded into our player:

- pauseAd() is called on our VideoAdPlayer object.
- IMA fires the CONTENT_RESUME_REQUESTED event.
- IMA fires the ALL_ADS_COMPLETED event.

Since IMA is still sending out these events I'm assuming that we are not destroying/resetting the IMA SDK properly.
Is there a proper way to do this? Are we doing something wrong here?

Thanks,
Rik

Vu Chau (IMA SDK Team)

unread,
Feb 12, 2016, 10:08:55 AM2/12/16
to Interactive Media Ads SDK, paul....@jwplayer.com
Hi Rik,

Calling .destroy() on the AdsManager and setting it to null should be sufficient for this purpose.  That is, the AdsManager will no longer be active.  The extra events (CONTENT_RESUME_REQUESTED and ALL_ADS_COMPLETED) are only to trigger content playback, but if your app logic acts upon them in anyway, then it's also advised to manually unregister them at this stage. 

Vu Chau
IMA SDK Team

r...@jwplayer.com

unread,
Feb 12, 2016, 11:38:40 AM2/12/16
to Interactive Media Ads SDK, paul....@jwplayer.com
Hi Vu,

Ignoring the events solved the problem for us.

We do however get a lot of logcat spam after destroying the AdsManager, about every 500 ms the following appears in logcat:

E/IMASDK﹕ Received monitor message: getViewability for invalid session id: ae8817bd-742b-41fd-99e7-8320b627b6c6

Is there a way to prevent that from happening?

Thanks,
Rik

Vu Chau (IMA SDK Team)

unread,
Feb 12, 2016, 2:09:41 PM2/12/16
to Interactive Media Ads SDK, paul....@jwplayer.com
Hey Rik,

That'd need some internal work here on the SDK, which the team has been working on.  In the meantime, if you'd like to filter out that particular log output, see Filtering Log Output.

Thanks,

Vu Chau
IMA SDK Team

Reply all
Reply to author
Forward
0 new messages