Ad Management (android)

    Advertising in the application is a very important point, and sometimes the only income.

    I think many people wondered which advertisement is better and where it is better to place. Each application is individual, so you need to experiment.

    Release experiment updates every time? Not an option. It is much better to store all the settings on the server side, and in the application implement the logic of displaying ads.

    But is it that simple?

    The purpose of this post:
    - to make a small contribution to open source ( source , demo )
    - to get adequate criticism
    - to find developers who are ready to support the project
    - to promote the Price application in China , where this approach is used

    Foreword


    I want to say right away that I'm not a very experienced Android / Java developer. I program mainly in php (over 5 years). This is my first android application, so do not judge strictly.

    Library features


    Types of Advertising

    - AdMob
    - StartAd.mobi
    - your banner, written in the form of html

    Display

    - Bottom
    - Top
    - In the list (with a given step)
    - Inside the specified element (indicate the id of the element)
    - Interstitial advertising (full screen)

    Examples of using


    Admob bottom

    AdMob ad = new AdMob(activity, adMobId);
    AdManager manager = new AdManager(ad);
    manager.show(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL);
    


    image

    Admob smart

    If you need to stretch the entire width of the screen
    adMob.setAdSize(AdSize.SMART_BANNER);
    


    image

    Your banner on top

    AdCustom ad = new AdCustom(activity, html);
    AdManager manager = new AdManager(ad);
    manager.show(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
    


    image

    In the list in steps of 15

    AdListAdapter adapter = new AdListAdapter(oldAdapter);
    AdMob ad = new AdMob(activity, adMobId);
    adapter.setStep(15);
    adapter.setAd(ad);
    adapter.notifyDataSetChanged();
    


    image

    In a particular place

    <LinearLayout
        android:id="@+id/inline_banner"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" />
    AdStartAd ad = new AdStartAd(activity, startadId);
    AdManager manager = new AdManager(ad);
    manager.showInView("inline_banner");
    


    image

    Interstitial banner

    AdMobInterstitialAd ad = new AdMobInterstitialAd(activity, admobId);
    ad.show();
    


    image

    Server side settings

    new AdsLoadTask(getActivity(), sectionNumber, adapter, "android").execute();
    


    Connection to the project


    At the moment, this is not a library, but a regular application. To use in your application you need to do the following:

    - transfer libraries from the libs folder
    - update the dependencies in build.gradle
    compile'com.google.android.gms:play-services:4.0.30'
    compile files('libs/StartADLib-1.0.1.jar')
    compile 'com.google.code.gson:gson:2.2.4@jar'

    - change AndroidManifest.xml
    <meta-dataandroid:name="email"android:value="you@email" /><meta-dataandroid:name="trackingId"android:value="yourid" /><meta-dataandroid:name="com.google.android.gms.version"android:value="@integer/google_play_services_version" /><activityandroid:name="com.google.android.gms.ads.AdActivity"android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />


    Future plans


    - implement backend for settings on the server. I have already implemented this in the project, but I need to somehow transfer it.
    - statistics of impressions (also implemented) and clicks
    - add more types of advertising
    - fix TODO and FIXME in the code
    - format as a library (and not as a project with copying files to the right places)
    - put in the maven repository

    Help


    There is not enough time as always, so any help from the developers will not hurt. Let's not be shy to do something and show it to others. I recalled the saying, "Do not be afraid to make a mistake, be careful not to try." I do not ask to realize something supernatural. Simply, if you will use one of these in your project and decide to add something new, or find some kind of bug - do not be lazy, send a pull request.

    Experiments and conclusions


    I experimented with advertising a lot (2 months) and found the best option for myself. Many users do not like it, but managed to increase the CTR from 0.2 to 0.9. There will be time - I will share statistics on the application (traffic, estimates, profit). Already have a little experience and have a story to tell.

    Only registered users can participate in the survey. Please come in.

    Are you interested in this?


    Also popular now: