Search in sources :

Example 1 with AdLayout

use of com.amazon.device.ads.AdLayout in project Klyph by jonathangerbaud.

the class AmazonBanner method createAdView.

@Override
public View createAdView(Activity activity, ViewGroup adContainer, final IBannerCallback callback) {
    Log.d("AmazonBanner", "createAdView: ");
    final AdLayout adView = new AdLayout(activity, AdSize.SIZE_300x250);
    adView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    adView.setListener(new com.amazon.device.ads.AdListener() {

        @Override
        public void onAdLoaded(AdLayout adView, AdProperties arg1) {
            callback.onReceiveAd(adView);
        }

        @Override
        public void onAdFailedToLoad(AdLayout adView, AdError error) {
            callback.onFailedToReceiveAd(adView, error.getMessage());
        }

        @Override
        public void onAdExpanded(AdLayout arg0) {
        }

        @Override
        public void onAdCollapsed(AdLayout arg0) {
        }
    });
    return adView;
}
Also used : LayoutParams(android.widget.RelativeLayout.LayoutParams) AdLayout(com.amazon.device.ads.AdLayout) AdProperties(com.amazon.device.ads.AdProperties) AdError(com.amazon.device.ads.AdError)

Example 2 with AdLayout

use of com.amazon.device.ads.AdLayout in project Klyph by jonathangerbaud.

the class AmazonBanner method loadAd.

@Override
public void loadAd(View adView) {
    Log.d("AmazonBanner", "loadAd: ");
    //AdRegistration.enableTesting(true);
    AdRegistration.enableLogging(true);
    ((AdLayout) adView).loadAd(new AdTargetingOptions());
}
Also used : AdLayout(com.amazon.device.ads.AdLayout) AdTargetingOptions(com.amazon.device.ads.AdTargetingOptions)

Aggregations

AdLayout (com.amazon.device.ads.AdLayout)2 LayoutParams (android.widget.RelativeLayout.LayoutParams)1 AdError (com.amazon.device.ads.AdError)1 AdProperties (com.amazon.device.ads.AdProperties)1 AdTargetingOptions (com.amazon.device.ads.AdTargetingOptions)1