Re: AdMob mediation with MobFox

518 views
Skip to first unread message

Eric Leichtenschlag

unread,
Jul 13, 2012, 2:56:31 PM7/13/12
to google-adm...@googlegroups.com
Hey Gicci,

This issue seems to be related to the Mobfox SDK/adapter; it looks like they're not providing the 480x75 px version of the image when the screen density is 1.5.  Both the SDK and adapter were written by MobFox, so I would recommend sending them an email at their support address (sup...@mobfox.com) to ask for help on this issue.

Thanks,
Eric


On Thu, Jul 12, 2012 at 5:25 PM, Gicci <gicc...@gmail.com> wrote:
I am trying to configure my AdMob mediation ads view to load MobFox ads on Android. I have setup everything as described, and my configuration tries to display a standard AdMob BANNER (320x50). The actual size from my logs is (I generate ad view programmatically):

07-12 23:19:35.313: D/Ads(5817): Creating Ads view 320,50 dp (78 px)
07-12 23:19:35.333: D/Ads(5817): SizeAd: 480,78

The device is a Galaxy S2, so the 78 comes from the 1.5 scale factor plus 2dp I have put on top. When displaying AdMob native ads or custom ad views generated directly by my app everything works fine, all the ad rectangle is completely filled, but with MobFox I get the ad scaled down. I have attached a screenshot displaying the result.

Any help will be appreciated.



Gicci

unread,
Jul 22, 2012, 7:11:33 PM7/22/12
to google-adm...@googlegroups.com
I had no reply from Mobfox, but somehow I solved the problem myself.

Yes, they COULD send banners smaller than the default size, but the rendering problem is present only on ICS phones with hardware acceleration enabled. A similar problem was present in AbMob 6.0.0 but has been fixed in 6.0.1.

To fix it, leaving the HW acceleration enabled at application level, put the AdMob's AdView in a container LinearLayout view, and set it with:

            // disable hardware acceleration to avoid flashing white background bug
            // NOTE: this is no longer needed after AdMob 6.0.1 release, but still needed for MobFox
            Reflect.setLayerType(this, 1, null); // setLayerType(View.LAYER_TYPE_SOFTWARE, null);

            // set the background color to black, as MobFox does not always provide a full banner size, and
            // with HW acceleration enabled at application level the background will not be solid black
            setBackgroundColor(Color.BLACK);

where

/** Wrapper class for methods which could not be supported */
public class Reflect {
   
    // method View.setLayerType
    private static Method view_setLayerType;

    static {
        try {
            view_setLayerType = View.class.getMethod("setLayerType", int.class, Paint.class);
        } catch (NoSuchMethodException nsme) { /* failure, must be older device */ }
    };

    public static void setLayerType(View v, int layerType, Paint paint)
    {
        // if unsupported operation just return
        if (view_setLayerType == null) return;
       
        try {
            view_setLayerType.invoke(v, Integer.valueOf(layerType), paint);
        } catch (Exception e) {}
    }
}

/Giuseppe


On Friday, July 13, 2012 8:56:31 PM UTC+2, Eric Leichtenschlag wrote:
Hey Gicci,

This issue seems to be related to the Mobfox SDK/adapter; it looks like they're not providing the 480x75 px version of the image when the screen density is 1.5.  Both the SDK and adapter were written by MobFox, so I would recommend sending them an email at their support address (sup...@mobfox.com) to ask for help on this issue.

Thanks,
Eric
Reply all
Reply to author
Forward
0 new messages