Artur L.
Artur L.

Reputation: 178

Custom native ads in android app

My application have Google Ads SDK implemented, and i am able to display my campaign in application - so half of my ad module is done :)

However, besides handling ads serving from Google DFP, i need to handle native ads from my external URL (ad details will be fetched from my server). Is there any way to configure Google DFP to fetch native ad from my custom URL? I need do something similar to VAST ad request, where I can provide URL for ad network, and DFP will do rest of the job (DFP will handle request between ad network and end user).

Upvotes: 1

Views: 1705

Answers (1)

jdstaerk
jdstaerk

Reputation: 892

this may help you:

AdLoader adLoader = new AdLoader.Builder(context, "/6499/example/native")
    .forAppInstallAd(new OnAppInstallAdLoadedListener() {
        @Override
        public void onAppInstallAdLoaded(NativeAppInstallAd appInstallAd) {
            // Show the app install ad.
        }
    })
    .forContentAd(new OnContentAdLoadedListener() {
        @Override
        public void onContentAdLoaded(NativeContentAd contentAd) {
            // Show the content ad.
        }
    })
    .withAdListener(new AdListener() {
        @Override
        public void onAdFailedToLoad(int errorCode) {
            // Handle the failure by logging, altering the UI, etc.
        }
    })
    .withNativeAdOptions(new NativeAdOptions.Builder()
            // Methods in the NativeAdOptions.Builder class can be
            // used here to specify individual options settings.
            .build())
    .build();

You can find the full "tutorial" here.

Upvotes: 3

Related Questions