Git Product home page Git Product logo

tedadhelper's Introduction

What is TedAdHelper?

English

Do you have your application?
Do you want make money using your application?
Then, you can add advertise in your application (banner, front ad, native ad, etc..)

If you want to know specific information, you can check this site.

And if you want use admob,facebook all, you need mediation
Admob and adlibr support mediation service.

But

They support mediation for only banner,front ad(don't support native ad mediation)
TedAdHelper support not only banner,front ad but also native ad, back press popup dialog
If you want show back press popup with advertise, you can use back press popup dialog.

Back Press Popup Dialog(with mediation)

Screenshot

Korean

TedAdHelper는 광고 퍼블리셔를 위한 라이브러리입니다.
Admob과 Facebook Audience Network를 사용하면서 2개 광고를 미디에이션하고 싶었습니다.
adlibr이나 Admob을 통해 미디에이션 설정을 할수 있지만 배너나 전면광고만 미디에이션이 가능하고 Native광고는 미디에이션 할 수 없습니다.
TedAdHelper에서는 Native Ad도 미디에이션 가능합니다.
(다만 Native광고의 특성상 라이브러리에서 만든 광고의 레이아웃형태로 밖에 보여줄수 없습니다.
본인이 원하는 레이아웃으로 보여주고 싶다면 직접 만드셔야 합니다.)

또한, 앱을 종료할때 광고와 함께 종료팝업을 보여주고자 하는 경우가 있습니다.
이러한 경우 팝업을 띄우고 몇개의 버튼과 함께 Native 광고를 보여주도록 하면되는데 TedAdHelper를 통해 미디에이션까지 포함하여 보여줄 수 있습니다.

뒤로가기 팝업 Dialog(with 미디에이션)

Screenshot





Setup

Gradle

Download

dependencies {
    compile 'gun0912.ted:tedadhelper:x.y.z'
}



How to use

Test

For test advertise, you have to use test mode.
If you using live advertise, your advertise id will block from google/facebook.
So when you test your application, you load test Advertise(using your device ID).
Your device ID can be obtained by viewing the logcat output after creating a new ad.

Before loading advertise, set test device ID like this.

  • Facebook: TedAdHelper.setFacebookTestDeviceId("")
  • Admob: TedAdHelper.setAdmobTestDeviceId("")

Type

You can use 3 type advertise

If you use TNK factory's advertise, you have declare code in your AndroidManifest.xml

  • <meta-data android:name="tnkad_app_id" android:value=""/>

Banner

  1. Make banner container in xml
 <FrameLayout
        android:id="@+id/bannerContainer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        />

  1. Show banner using TedAdBanner
TedAdBanner.showBanner(ViewGroup bannerContainer, String facebookKey, String admobKey, int adPriority, OnBannerAdListener onBannerAdListener)
  • adPriority: TedAdHelper.AD_FACEBOOK / TedAdHelper.AD_ADMOB
        /**
         * Banner
         */

        FrameLayout bannerContainer = (FrameLayout) findViewById(R.id.bannerContainer);

        //TedAdBanner.showFacebookBanner();
        //TedAdBanner.showAdmobBanner();

        TedAdBanner.showBanner(bannerContainer, FACEBOOK_KEY_BANNER, ADMOB_KEY_BANNER, TedAdHelper.AD_FACEBOOK, new OnBannerAdListener() {
            @Override
            public void onError(String errorMessage) {

            }

            @Override
            public void onLoaded(int adType) {

            }

            @Override
            public void onAdClicked(int adType) {

            }

            @Override
            public void onFacebookAdCreated(com.facebook.ads.AdView facebookBanner) {
            }

        });





Front AD

TedAdFront.showFrontAD(Context context, String facebookKey, final String admobKey, Integer[] adPriorityList, OnFrontAdListener onFrontAdListener)
  • adPriorityList: TedAdHelper.AD_FACEBOOK / TedAdHelper.AD_ADMOB / TedAdHelper.AD_TNK
        /**
         * Front AD
         */

        //TedAdFront.showAdmobFrontAd();
        //TedAdFront.showFacebookFrontAd();
        TedAdFront.showFrontAD(this, FACEBOOK_KEY_FRONT, ADMOB_KEY_FRONT, new Integer[]{TedAdHelper.AD_ADMOB,TedAdHelper.AD_FACEBOOK,TedAdHelper.AD_TNK}, new OnFrontAdListener() {
            @Override
            public void onDismissed(int adType) {

            }

            @Override
            public void onError(String errorMessage) {

            }

            @Override
            public void onLoaded(int adType) {

            }

            @Override
            public void onAdClicked(int adType) {

            }

            @Override
            public void onFacebookAdCreated(InterstitialAd facebookFrontAD) {
            }
        });





BackPress Popup Dialog

Screenshot

TedBackPressDialog.startDialog(Activity activity, String appName, String facebookKey, String admobKey, Integer[] adPriorityList, boolean showReviewButton,OnBackPressListener onBackPressListener)
  • adPriorityList: TedAdHelper.AD_FACEBOOK / TedAdHelper.AD_ADMOB / TedAdHelper.AD_TNK
  • TedAdHelper.ADMOB_NATIVE_AD_TYPE : NATIVE_EXPRESS / NATIVE_ADVANCED / BANNER
    : If you use admob platform, you have to choice admob ad type
  • If you use Glide 4.x version, you have to make your image provider new TedAdHelper.ImageProvider(). You can check this function in sample project
    @Override
    public void onBackPressed() {

        //TedBackPressDialog.startFacebookDialog();
        //TedBackPressDialog.startAdmobDialog();
        TedBackPressDialog.startDialog(this, getString(R.string.app_name), FACEBOOK_KEY_BACKPRESS, ADMOB_KEY_BACKPRESS, TedAdHelper.AD_FACEBOOK, new OnBackPressListener() {
            @Override
            public void onReviewClick() {
            }

            @Override
            public void onFinish() {
                finish();
            }

            @Override
            public void onError(String errorMessage) {
            }

            @Override
            public void onLoaded(int adType) {
            }

            @Override
            public void onAdClicked(int adType) {
            }
        });
    }





Native AD

  1. Make your Native ad container and include adview_native_base.xml
  <FrameLayout
        android:id="@+id/native_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        />
>
  1. Make instance and Show Native ad using TedNativeAdHolder
    TedAdHelper.ADMOB_NATIVE_AD_TYPE : NATIVE_EXPRESS / NATIVE_ADVANCED / BANNER
    : If you use admob platform, you have to choice admob ad type
        View nativeContainer = findViewById(R.id.native_container);
        TedNativeAdHolder tedNativeAdHolder = new TedNativeAdHolder(nativeContainer, this, getString(R.string.app_name), FACEBOOK_KEY_NATIVE, ADMOB_KEY_NATIVE, TedAdHelper.ADMOB_NATIVE_AD_TYPE);

        tedNativeAdHolder.loadAD(new Integer[]{TedAdHelper.AD_FACEBOOK,TedAdHelper.AD_ADMOB}, new OnNativeAdListener() {
            @Override
            public void onError(String errorMessage) {

            }

            @Override
            public void onLoaded(int adType) {

            }

            @Override
            public void onAdClicked(int adType) {

            }
        });
        //tedNativeAdHolder.loadFacebookAD();
        //tedNativeAdHolder.loadAdmobAD();
  • If you use Glide 4.x version, you have to make your image provider new TedAdHelper.ImageProvider(). You can check this function in sample project





Customize

Color

You can change button or divider color. Override variable in your colors.xml

    <color name="tedBtnPrimary">...</color>
    <color name="tedBtnHighlight">...</color>

Check Facebook app

If you want request facebook advertise for only facebook app installed user, you can use showAdOnlyFacebookInstalledUser(). Library check facebook app installed or not.

TedAdHelper.showAdOnlyFacebookInstalledUser(true);





FAQ

1. I got error message leaked IntentReceiver com.facebook.ads.internal.DisplayAdController$c@cf9db8c that was originally registered here. Are you missing a call to unregisterReceiver()?

If you use Facebook Audience Network, you have to destroy your banner or front ad

    @Override
    protected void onDestroy() {

        if (facebookFrontAD != null) {
            facebookFrontAD.destroy();
        }

        if (facebookBanner != null) {
            facebookBanner.destroy();
        }

        super.onDestroy();
    }

You can get facebookFrontAD,facebookBanner instance from onFacebookAdCreated(InterstitialAd facebookFrontAD) method

  TedAdFront.showFrontAD(this, FACEBOOK_KEY_FRONT, ADMOB_KEY_FRONT, TedAdHelper.AD_ADMOB, new OnFrontAdListener() {
           
           ...

            @Override
            public void onFacebookAdCreated(InterstitialAd facebookFrontAD) {
                MainActivity.this.facebookFrontAD = facebookFrontAD;
            }
        });



2. I want change native ad layout

If you want customize your native ad, you have to overwrite view id.
Make your layout (not include <include layout="@layout/adview_native_base"/> code)
You have to declare view id

  • R.id.view_native_root (RelativeLayout): If Native ad load fail, this view will disappear
  • R.id.container_admob_express (container_admob_express): For add admobExpress
  • R.id.progressView (ProgressBar): When advertise loading, this view will appear
  • R.id.view_container (LinearLayout): when advertise loaded, this view will appear
  • R.id.iv_logo (ImageView)
  • R.id.tv_name (TextView)
  • R.id.native_ad_media (com.facebook.ads.MediaView)
  • R.id.iv_image (ImageView)
  • R.id.tv_body (TextView)
  • R.id.tv_call_to_action (TextView)
  • R.id.tv_etc (TextView)
  • R.id.view_ad_choice (RelativeLayout)



License

Copyright 2017 Ted Park

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.```

tedadhelper's People

Contributors

gun0912 avatar parksanggwon avatar yoonkyoungtae avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tedadhelper's Issues

is not working when use this library with "FirebaseMessagingService"

I try to use this library. but my project is occured some error.

one of Errors is about "FirebaseMessagingService"

i have to use "FirebaseMessagingService"(FCM). also, i'd like to use this library.

your library is very useful. Thank you.

=====

안녕하세요. 금일 해당라이브러리를 사용하고자 하였으나, "FirebaseMessagingService"와 같이 사용시에 에러가 발생하였습니다.

제공된 샘플 project에 FirebaseMessagingService을 추가하여도 동일한 문제가 발생하였습니다.

해당 라이브러리를 사용하는것이 매우 좋은듯 하여 사용하고자 하나 해당문제로 사용이 불가능합니다 :(

가능하시다면, 해당 이슈를 해결부탁드리겠습니다.

감사합니다.

Rename "Front Ad" to Interstitial Ad

The name "Front Ad" is not standard and it took me a moment to understand what you meant by that.

Please rename all instances of ""Front Ads"" to "Interstitial Ads" as those are the right words for it and will make it much clearer.

Can not access TedAdHelper classes after adding Dependency

I try to use this library.but i am facing some issues after adding this library in my project i can't access tedadhelper classes and interfaces as well.
If i go to the Second option add as a module in my project then "versions unknown" and "deps" errors occurs. Waiting for your response.

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.