Wednesday, August 10, 2011

innerActive & AdWhirl, take 2

Few days ago I've published a post how to make an AdWhirl adapter for innerActive. Just after publishing the post I've noticed innerActive released a major version for their Android SDK (3.0.3).

Here is the new adapter:

Thursday, August 4, 2011

Using innerActive ads on Android (with AdWhirl)

UPDATE- This post is obsolete, please check this update post.


I've decided to try using multiple ad agencies, and one of them was innerActive. I had 2 problems with innerActive: (1) They don't supply an AdWhirl adapter, (2) There's seem to be a bug in their SDK as of version 2.0625

Problem A: The bug
The function onWindowFocusChanged which runs on the UI thread calls the function setRefreshInterval which has the keyword synchronized which means it waits for a lock. The lock is taken by the ad request thread. If the onWindowsFocusChanged will be called during an ad request there will be an ANR exception due to a delay on the UI thread.

Solution:
I wrote a wrapper that seems to fix this issue.



Problem B: No AdWhirl adapter
Solution:
I wrote a custom AdWhirl adapter for innerActive.


I'm not going to write a step-by-step guide, but here is the key notes:
  1. Integrate innerActive ads & make sure everything works.
  2. Remove the ad view from the layout & the appropriate code the the ad view.
  3. Integrate AdWhirl:
    3.1. Create an application in AdWhirl web site & get SDK Key
    3.2. Add AdWhirl JAR
    3.3. Add the AdWhirl SDK Key to the AndroidManifest.xml
    3.4. Add the com.adwhirl.AdWhirlLayout to the application layout
  4. Add the following code (in the onCreate functions)
    AdWhirlLayout adWhirlLayout = (AdWhirlLayout)findViewById(R.id.adwhirl_layout);
    adWhirlLayout.setAdWhirlInterface(new InnerActiveCustomEvents(adWhirlLayout));
  5. Add innerActive to AdWhirl as custom event - name: innerActive, function name: inneractiveBanner


Notes -

  • If you're using multiple custom events, they should all be in the same function, so copy only the inneractiveBanner function.

  • If you're using ProGaurd make sure you read my previous post & also add the custom events adapter & innerActive ad views to the ProGuard exceptions list.