Tagads

How to combine Madvertise with another ad network

A lot of people asked me how I implement the switch of Madvertise to another ad network. Here is how I do it:

I’m doing this example using an AdMob and an Madvertise view. Of course you can use any other similar networks like Adwhirl or Mobclix as well but I’m assuming you are familiar with including the two SDKs you are using.

At first we need a layout resource, here it is:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
  xmlns:mad="http://schemas.android.com/apk/res/com.andlabs.gi"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  > 
          <com.google.ads.AdView
            android:id="@+id/admad"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            ads:adUnitId="y0ur4dun1t1dh3r3"
            ads:adSize="BANNER"
            ads:loadAdOnCreate="true"
            />
         <de.madvertise.dev.android.MadView
             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"
             mad:deliverOnlyText="false"
             android:visibility="gone"     
             />                
</FrameLayout>

Pretty basic. A Madvertise and an AdMob view. Next step: Get them in your Activity:

 private MadView mMadView;
 private AdView mAdmView;
 @Override
     public void onCreate(Bundle bundle) {
          super.onCreate(bundle);
          /* ... */
          mAdmView = (AdView)findViewById(R.id.admad);
          mMadView = (MadView)findViewById(R.id.madad);
     }


That’s easy too. Next, register an MadViewCallbackListener and switch the views the way you need it. As you have seen the MadView is invisible at the beginning. I assume that Madvertise always brings in more money, so when I receive an ad by them, I set the AdMob view to invisible and the MadView to visible. That’s essentially it:

 mMadView.setMadViewCallbackListener(new MadViewCallbackListener() {
     @Override public void onLoaded(boolean success, MadView arg1) {
          if (success) {
               if(D) {
                    Log.d(this.getClass().getSimpleName(), "MadAd Received");
               }  
               if (mAdmView.getVisibility() == View.VISIBLE) {
                    mAdmView.setVisibility(View.GONE);
               }
               mMadView.setVisibility(View.VISIBLE);
          } else {
               if(D) {
                    Log.d(this.getClass().getSimpleName(), "No MadAd Received");
               }
               mMadView.setVisibility(View.GONE);
          }
     }
 });

Not a big deal. And that’s all. Now you have your own little meta ad network.

 

Please feel free to leave your experiences, questions or suggestions in the comments.

Android Money Report – I’m not the only one

I started publishing my first money report after I was browsing the AndEngine Forums. Someone had published some very basic conzepts on how to monetise ones app (like ads, in-app-billing, freemium, …). Another user shared a link of a Polish blog whose owner had published some of his income data. This inspired me to go the same way and publish my private Android income too.

The others

However, as I found out, I’m not the only one. Here are some other blogs who also publicise their Android incomes:

If you know any other than that, please leave a comment.

Value vs. money

While some people are convinced that you have to make your decision between making usefull apps vs. makeing money, I’m totally sure, and my experiences prove that, that on the long run, usefull apps with a certain value to the user, continuously improved and with a neat design will pay off. A good design might be the biggest problem to most developers (including me). This is why my most important tipp here is: Go to a screen designer and give him (little) money to design your app. In most cases this will be one of the best investments you ever did.

Here’s just a little example of what I mean, you decide which one you’d prefer:

The old design of the AL Voice Recorder

The old design of the AL Voice Recorder

The new design of the AL Voice Recorder

The new design of the AL Voice Recorder

© 2024 Droid-Blog

Theme by Anders NorenUp ↑