androidadmobadwhirl

AdWhirl on Android - Sum of ration weights is 0 - no ads to be shown


I can't get Adwhirl to work. After an hour of trying the official documentation, I tried the minimalistic route, through XML:

 <com.adwhirl.AdWhirlLayout
     android:id="@+id/addwhirlview"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content" /> 

This piece of code is in the same place as my original AdMob code, (com.google.ads.AdView), which worked fine.

I get the following on AdWhirl from LogCat:

I/AdWhirl SDK(18641): Creating adWhirlManager...
D/AdWhirl SDK(18641): Locale is: en_US
D/AdWhirl SDK(18641): Hashed device ID is: 7d1dd13a2fa91c0ad174cb69a11549a3
I/AdWhirl SDK(18641): Finished creating adWhirlManager
D/AdWhirl SDK(18641): Prefs{427dbf543f7849e6bd9e8c425a2a52a6}: {"config": "{"extra":{"location_on":1,"background_color_rgb":{"red":0,"green":0,"blue":0,"alpha":1},"text_color_rgb":{"red":255,"green":255,"blue":255,"alpha":1},"cycle_time":30,"transition":8},"rations":[]}
D/AdWhirl SDK(18641): ", "timestamp": 1343402294184}
I/AdWhirl SDK(18641): Using stored config data
D/AdWhirl SDK(18641): Received jsonString: {"extra":{"location_on":1,"background_color_rgb":{"red":0,"green":0,"blue":0,"alpha":1},"text_color_rgb":{"red":255,"green":255,"blue":255,"alpha":1},"cycle_time":30,"transition":8},"rations":[]}
I/AdWhirl SDK(18641): Sum of ration weights is 0 - no ads to be shown

I googled the problem, which brought me to this question: Empty AdWhirl layout on android (no ads shown). The guy was basically experiencing the same as me, said he figured it out, but never posted how.

I got my AdWhirl key in the manifest, I set up Admob as my only Ad Network, and added the app in the app list, etc., so I'm fairly sure that that side is correct.. What am I doing wrong, what does "Sum of ration weights is 0" even mean?

Thanks in advance!


Solution

  • In AdWhirl, a Ration represents information about an ad network that you've configured. The Ad network has a name and network id (AdWhirl sets these), as well as a percentage value and any keys you specified for that network (in AdMob's case only one key is used - the publisher ID).

    AdWhirl then pulls in your config, and adds up the ration weights (the percentages) for each network you've configured. In your case, the percentages added up to 0.

    Why did this happen? Your JSON string contains "rations":[], meaning that the config AdWhirl pulled didn't have any ad networks configured. You'll notice that the logs also say Using stored config data, meaning it cached the config from a previous pull. It's likely that you recently updated your configuration, but AdWhirl is still caching the old one.

    You can check http://mob.adwhirl.com/getInfo.php?appver=3.2.0&appid=REPLACE_WITH_YOUR_APP_ID in a web browser (insert your own SDK KEY) to see if the AdWhirl backend is serving the new configuration. If you have AdMob correctly configured, you should see an entry in the rations array.

    Once you've verified that the AdWhirl backend is serving the correct config, you can make AdWhirl cache less aggressively. You can do this like so:

    AdWhirlManager.setConfigExpireTimeout(1000 * 10);
    

    This will make AdWhirl only cache the config every 10 seconds, meaning it will essentially pull a new config on every refresh. AdMob should then show up on the next config pull, and everything should work from there.

    Note that in general it's a good idea to cache the config for a longer period of time so your app doesn't have to pull a config every refresh. You may consider caching for something like 30 minutes under normal circumstances:

    AdWhirlManager.setConfigExpireTimeout(1000 * 60 * 30);