Search in sources :

Example 1 with AdView

use of com.google.ads.AdView in project Klyph by jonathangerbaud.

the class AdmobBanner method createAdView.

@Override
public View createAdView(Activity activity, ViewGroup adContainer, final IBannerCallback callback) {
    // Prevent some crashes in some particular cases
    try {
        WebViewDatabase.getInstance(activity).clearFormData();
    } catch (SQLiteDiskIOException e) {
    }
    final AdView adView = new AdView(activity, AdSize.BANNER, adMobId);
    /*float density = KlyphDevice.getDeviceDensity();
		int height = Math.round(AdSize.IAB_MRECT.getHeight() * density);
		ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, height);
		adView.setLayoutParams(params);*/
    adView.setAdListener(new AdListener() {

        @Override
        public void onReceiveAd(Ad arg0) {
            callback.onReceiveAd(adView);
        }

        @Override
        public void onPresentScreen(Ad arg0) {
        }

        @Override
        public void onLeaveApplication(Ad arg0) {
        }

        @Override
        public void onFailedToReceiveAd(Ad arg0, ErrorCode errorCode) {
            callback.onFailedToReceiveAd(adView, errorCode.name());
        }

        @Override
        public void onDismissScreen(Ad arg0) {
        }
    });
    return adView;
}
Also used : IBannerAd(com.abewy.android.ads.IBannerAd) Ad(com.google.ads.Ad) SQLiteDiskIOException(android.database.sqlite.SQLiteDiskIOException) ErrorCode(com.google.ads.AdRequest.ErrorCode) AdView(com.google.ads.AdView) AdListener(com.google.ads.AdListener)

Example 2 with AdView

use of com.google.ads.AdView in project TextureViewDemo by dalinaum.

the class CameraSurfaceTextureListener method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.content);
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    final AdView adView = new AdView(this, AdSize.SMART_BANNER, "a1513f5a0d88abc");
    final FrameLayout adContainer = (FrameLayout) findViewById(R.id.adContainer);
    adContainer.addView(adView);
    AdRequest adRequest = new AdRequest();
    // adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
    adView.loadAd(adRequest);
    mCameraSurfaceTextureListener = new CameraSurfaceTextureListener(this);
    mTextureView = (TextureView) findViewById(R.id.texture_view);
    mTextureView.setSurfaceTextureListener(mCameraSurfaceTextureListener);
}
Also used : AdRequest(com.google.ads.AdRequest) FrameLayout(android.widget.FrameLayout) AdView(com.google.ads.AdView) ActionBar(android.app.ActionBar)

Example 3 with AdView

use of com.google.ads.AdView in project Klyph by jonathangerbaud.

the class AdmobBanner method loadAd.

@Override
public void loadAd(View adView) {
    AdRequest ar = new AdRequest();
    if (BannerAdManager.getTargetingBirthday() != BannerAdManager.NONE) {
        Date date = new Date();
        date.setTime(BannerAdManager.getTargetingBirthday());
        ar.setBirthday(date);
    }
    ((AdView) adView).loadAd(new AdRequest());
}
Also used : AdRequest(com.google.ads.AdRequest) AdView(com.google.ads.AdView) Date(java.util.Date)

Example 4 with AdView

use of com.google.ads.AdView in project TextureViewDemo by dalinaum.

the class Canvas2Activity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.content);
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    final AdView adView = new AdView(this, AdSize.SMART_BANNER, "a1513f5a0d88abc");
    final FrameLayout adContainer = (FrameLayout) findViewById(R.id.adContainer);
    adContainer.addView(adView);
    AdRequest adRequest = new AdRequest();
    // adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
    adView.loadAd(adRequest);
    mTextureView = (TextureView) findViewById(R.id.texture_view);
    mTextureView.setSurfaceTextureListener(new CanvasListener());
    mTextureView.setOpaque(false);
}
Also used : AdRequest(com.google.ads.AdRequest) FrameLayout(android.widget.FrameLayout) AdView(com.google.ads.AdView) ActionBar(android.app.ActionBar)

Example 5 with AdView

use of com.google.ads.AdView in project TextureViewDemo by dalinaum.

the class CanvasActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.content);
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    final AdView adView = new AdView(this, AdSize.SMART_BANNER, "a1513f5a0d88abc");
    final FrameLayout adContainer = (FrameLayout) findViewById(R.id.adContainer);
    adContainer.addView(adView);
    AdRequest adRequest = new AdRequest();
    // adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
    adView.loadAd(adRequest);
    mTextureView = (TextureView) findViewById(R.id.texture_view);
    mTextureView.setSurfaceTextureListener(new CanvasListener());
    mTextureView.setOpaque(false);
}
Also used : AdRequest(com.google.ads.AdRequest) FrameLayout(android.widget.FrameLayout) AdView(com.google.ads.AdView) ActionBar(android.app.ActionBar)

Aggregations

AdView (com.google.ads.AdView)6 AdRequest (com.google.ads.AdRequest)5 ActionBar (android.app.ActionBar)4 FrameLayout (android.widget.FrameLayout)4 SQLiteDiskIOException (android.database.sqlite.SQLiteDiskIOException)1 IBannerAd (com.abewy.android.ads.IBannerAd)1 Ad (com.google.ads.Ad)1 AdListener (com.google.ads.AdListener)1 ErrorCode (com.google.ads.AdRequest.ErrorCode)1 Date (java.util.Date)1