The new madvertise Android-SDK

Three days ago, madvertise, one of my favourite ad networks, updated its Android SDK in a major update to 2.0. So what changed and what’s new? Here is an overview over the major changes.

First of all, get the new SDK here.

How to make it work again: Renamed classes

When updating the new SDK, there are some minor changes a developer has to consider.

In order to make the naming of the SDK for iOS and Android equal, the names of the classes have been changed. Every class that started with ‘Mad‘ before now starts with ‘Madvertise’. So the MadViewCallbackListener is now called MadvertiseViewCallbackListener and the MadView is now called MadvertiseView. Accordingly, the method to set the MadvertiseViewCallbackListener is now called setMadvertiseViewCallbackListener(), not setMadViewCallbackListener().

The MadvertiseViewCallbackListener now has two more callback methods:

public void onError(Exception exception)

which will be called when an exception in the SDK occurs and

public void onIllegalHttpStatusCode(int statusCode, String message)

which will be called when the madvertise-Server returns something different than a HTTP status code 200. The code you will probably see the most is a 204, which means that the device requesting an ad is not yet known to the madvertise-Server.

Also, the banner-type ‘iab’ has been renamed to ‘medium_rectangle’. However, at the moment ‘iab’ still works.
When you included all these changes, everything should work fine again.

New functionality

The update of the SDK adressed some bugs many of you experienced. Here is an excerpt:

  • Requests are now interrupted when a MadvertiseView is destroyed.
  • No reloading of ads when a phone is turned, keyboard is being opened, and so on, anymore.
  • Banners are scaled correctly now.
  • Before, when the request interval was set to <60, it was adjusted to 30 automatically.
  • The width of a MadvertiseView was sometimes not calculated correctly

There are also some improvements where you have to do nothing to activate them:

  • Animated banners: Ads provided as animated GIFs are now played when the device is capable of doing so.
  • Banners are shown automatically now, so you don’t need a MadvertiseViewCallbackListener to make your ads visible anymore.
  • Ads now don’t acquire space in the layout before they are shown.
  • Multiple ads: You can now display more than one ad on a screen, for example one fixed on top and one in a list. However, the total number of ads on a screen should not exceed four.

And there are some new features you should think of when integrating the new SDK:

  • New banner formats – you can now display the following banner types:
    • mma (320×53)
    • medium_rectangle (320×200)
    • leaderboard (728×90)
    • fullcreen (768×768)
    • portrait (766×66)
    • landscape (1024×66)
  • Multiple banner formats – you can now request multiple banner formats in your XML-declaration of a MadvertiseView like this:
           <de.madvertise.android.sdk.MadvertiseView
             android:id="@+id/madad"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             mad:isTestMode="false"
             mad:backgroundColor2="#000000"
             mad:textColor="#FFFFFF"
             mad:bannerType="mma,portrait,landscape,leaderboard"
             mad:deliverOnlyText="false"
             />

The list is sorted by priority. So in the above example, when there is no mma-banner available, a portrait-banner will be shown, when there is no portrait-banner, a landscape-banner will be shown, and so on.

  • Animations: Ads can now be animated when they are received. To add an animation, add <attr name="animation" format="string" /> to your attrs.xml file. Now you can set animations in your XML-layout using mad:animation. You can choose between fade (default), left_to_right and top_down.
  • New request parameters: You can set the gender and age of your users by calling MadvertiseView.setGender() or MadvertiseView.setAge(). As these methods are static, it is recommended to call them before your layout is inflated.

 Conclusion

The new madvertise SDK comes with some nice new features and bug fixes. The new formats are suitable for tablets and phones with large screens like the Galaxy Nexus. I’m curious whether the animation banners and animation of new banners will lead to more clicks.

 

Please feel free to leave your thoughts and questions on the new update in the comments below.

20 Comments

  1. Hi,
    thanks for this explanation. You are right, the animations may well increase the user attention on ads.
    I have a question regarding your web site : why has the RSS feed disapeared ? (/feed) is there a mean to get it back ? thanks

    • Hello Julien,
      I can’t remember changing anything regarding the feed. I currently have a tough schedule but I will come back to you after I figured it out.
      Thank you for the report.
      Best regards
      Johannes

  2. Johannes, thanks for posting such a detailed description of the new features!
    We’re looking forward to our publishers’ feedback to the new version.

    Also, another update will follow shortly with an adwhirl integration!

    Best,
    Antje

  3. Hi there,

    seems the clone command doesnt work. I get an:

    Permission denied (publickey).
    fatal: The remote end hung up unexpectedly

    when trying to clone the github :-(

    • Hi Richard,
      the repository is public so there should ot be any problems with permissions. However, I’ve read about this problem on, I think, Androidpit before. Maybe you can find a solution there. If that’s not the case you can still use the zip-download provided on GitHub but that’s a bit dirty compared to Git.
      Best regards
      Johannes

  4. Has your fillrates improved when you changed to the newer sdk ? Im still using the older sdk. Will your admob + madvertise adnetwork code work in the newer sdk?

    • Hello Thrasheri,
      I’m not using the new SDK long enough to give a qualified statement to that answer. I will come back to this topic in my next income report.
      Thank you for asking.
      Best regards
      Johannes

    • Sorry, I forgot to answer your second question: Yes, the code will still work, you just have to rename the classes and ad the two callback methods to the listener.
      Best regards
      Johannes

  5. ollidiemaus

    2011/10/30 at 20:33

    Hi Johannes,
    I’ve got a question:
    this the onCreate Procedure:
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    // set the callback listener, to receive a message when an ad was loaded
    MadvertiseView madvertiseView = (MadvertiseView) findViewById(R.id.madad);
    madvertiseView.setMadvertiseViewCallbackListener(this);
    }

    Where do I have to implement the new callback methods?
    Because I get 2 errors called:

    Description Resource Path Location Type
    Description Resource Path Location Type
    The type MainActivity must implement the inherited abstract method MadvertiseView.MadvertiseViewCallbackListener.onError(Exception)
    and
    Description Resource Path Location Type
    The type MainActivity must implement the inherited abstract method MadvertiseView.MadvertiseViewCallbackListener.onIllegalHttpStatusCode(int, String)

  6. I always receive HTTP status code 204 when using the new SDK testing my App on a Nexus S device . Are you sure this means device unknown?

    • Hello Stephan,
      to be more precise this means that the used header string is unknown. So when you recently updated your Nexus S to Android 2.3.6 for example, its header might still be unknown. You can see the String in the logs, maybe you can mail it to madvertise so that they include it.

      Best regards
      Johannes

  7. Hi @ all,
    if you experience any problems with the madvertise SDKs, you can always send an email to support@madvertise.com. We’re very happy to help you!

    Best,
    Antje

  8. Solved the cloning problem. Use

    $ git clone https://github.com/madvertise/madvertise-android-sdk

    and it works!

  9. Karl Kristian

    2011/11/07 at 06:17

    HI

    Im currently having some issue with compiling.

    The only error I get is in the layout where i try to put in the banner.

    It says something about mad:background not being recognized..
    Any thoughts?

    • Hello Karl,
      yes, try using either mad:backgroundColor to set the background color of your text ads or use android:background to set the background drawable or color of the MadvertiseView.

      Best regards
      Johannes

  10. Hi!
    I use http://droid-blog.net/2011/08/19/how-to-combine-madvertise-with-another-ad-network/
    but it doesn’t work with the new Admob (4.3.1) and new Madvertise version. Do you have a fix to get both working again?

  11. Hi! Is favourable combine some ad networks in an unique app? The idea is create a code thats allow implements all your networks and rotate them time to time. Is “effective”?

    Sorry my bad english

    • Hi Juan,

      that depends on the implementation of course. Maybe you want to take a look on AdWhirl or AdMob’s new mediation framework.

      Best regards
      Johannes

Leave a Reply

Your email address will not be published.

*

© 2017 Droid-Blog

Theme by Anders NorenUp ↑