NativeAd Integration Guide - united-adstir/AdStir-Integration-Guide-Android GitHub Wiki

Important: About SDK Update

When update the SDK, strongly recommended update all files in SDK package.

Supported OS version

Android 4.4 or later.

Partner ad netowrks

Please see the page of here

Native Ads Guideline

Sponsor notation

Make sure to indicate that it is an Advertisement. Please send the displayed Advertisement notation at the time of request.

GOOD Example:

  • "PR"
  • "Sponsored Advertisement"
  • "Sponsored"
  • "Advertisement"
  • "AD"

BAD Example(Display misunderstanding Ads as contents):

  • "Recommended"
  • "Recommended Apps"
  • "Recommended Info"
  • "Featured"
  • "Suggrested"

Icon Image

  • It is free layout by scaling. Please do not display in size extremely low visibility.
  • Prohibit changing aspect ratio and trimming.
  • Circular and Rectangular icon images may be provided.

Title

  • 20 characters or more.(About 30 characters are recommended)

Description

  • 20 characters or more.(About 100 characters are recommended)

Banner Image

  • It is free layout by scaling. Please do not display in size extremely low visibility.
  • Prohibit changing aspect ratio and trimming.

Rating

  • Rating from 0 to 5.
  • It may differ from the number of ratings in the app store.

CTA(Call To Action) Button Text

  • "Install" "Buy" and other materials. It can not be edited.

Other provisions

  • DO NOT include other content in the click area.
  • Please make sure that each advertisement material is viewable.
  • Be sure to use the requested advertisement material.

Setup

Before integration

Please see Initial-Setting to setup.

For MoPub Ads integration

Before MoPub Ad integration, please contact your account manager or contact from Contact Form.

Prease refer to here.

Integration

Create a View to display Native Ads and get Native Ads in the next steps.

  1. Create AdstirNativeAd instances
  2. Setting sponsor notation prescribed in the guideline
  3. Set up a Listener to receive Native Ad response
  4. Mapping Native Ads
  5. Load Native Ads
  6. Destroy Native Ads

1. Create AdstirNativeAd instances

Create AdstirNativeAd instances with using Media ID and Ad Unit No obtained from dashboard

AdstirNativeAd nativead = new AdstirNativeAd(activity,"MEDIA ID",Ad Unit No);

2. Setting sponsor notation prescribed in the guideline

nativead.setSponsoredText("PR");

3. Set up a Listener to receive Native Ad response

Receive native ads with a listener.

nativead.setListener(new AdstirNativeAdListener(){
        public void onReceive(final AdstirNativeAdResponse response){
            nativeAd = response;
        }
        public void onFailed(){
            // Failed to get Native Ads;
        }
});

4. Mapping Native Ads

Mapping Native Ads. Call the "impression()" when displaying Native Ads.

// All AdstirNativeAdListener methods work on background threads.
runOnUiThread(new Runnable(){
    public void run(){
        // title
        TextView titleView = (TextView) findViewById(R.id.xxxx);
        titleView.setText(response.getTitle());
        // description
        TextView descriptionView = (TextView) findViewById(R.id.xxxx);
        descriptionView.setText(response.getDescription());
        // icon
        ImageView iconView = (ImageView) findViewById(R.id.xxxx);
        response.bindIconToImageView(NativeActivity.this, iconView);
        // image
        ImageView imageView = (ImageView) findViewById(R.id.xxxx);
        response.bindImageToImageView(NativeActivity.this, imageView);
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                response.click();
            }
        });
        // rate
        TextView rateText = (TextView) findViewById(R.id.xxxx);
        rateText.setText("rate : " + String.valueOf(response.getRating()));
        // CTA
        Button cta = (Button) findViewById(R.id.native_cta);
        cta.setText(response.getCta());
        cta.setOnClickListener( new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                response.click();
            }
        });
    }
});

:
:
response.impression();

5. Load Native Ads

Start Native Ads request.

nativead.getAd();

6. Destroy Native Ads

Destroy AdstirNativeAd with onDestroy().

@Override
protected void onDestroy() {
    nativead.destroy();
    super.onDestroy();
}

Implementation Sample

private AdstirNativeAd nativead;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.xxxx);

    // Create AdstirNativeAd instances
    nativead = new AdstirNativeAd(activity,"Media ID",Ad Unit No);
    // Sponsor notation prescribed in the guideline
    nativead.setSponsoredText("PR");
    // Set up a Listener to receive Native Ad response
    nativead.setListener(new AdstirNativeAdListener(){
        public void onReceive(final AdstirNativeAdResponse response){
        // All AdstirNativeAdListener methods work on background threads.
            runOnUiThread(new Runnable(){
                public void run(){
                    // title
                    TextView titleView = (TextView) findViewById(R.id.xxxx);
                    titleView.setText(response.getTitle());
                    // description
                    TextView descriptionView = (TextView) findViewById(R.id.xxxx);
                    descriptionView.setText(response.getDescription());
                    // icon
                    ImageView iconView = (ImageView) findViewById(R.id.xxxx);
                    response.bindIconToImageView(NativeActivity.this, iconView);
                    // image
                    ImageView imageView = (ImageView) findViewById(R.id.xxxx);
                    response.bindImageToImageView(NativeActivity.this, imageView);
                    imageView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            response.click();
                        }
                    });
                    // rate
                    TextView rateText = (TextView) findViewById(R.id.xxxx);
                    rateText.setText("rate : " + String.valueOf(response.getRating()));
                    // CTA
                    Button cta = (Button) findViewById(R.id.native_cta);
                    cta.setText(response.getCta());
                    cta.setOnClickListener( new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            response.click();
                        }
                    });
                }
            });
            // Call the "impression()" when displaying Native Ads.
            response.impression();
        }
        public void onFailed(){
            // Failed to get Native Ads;
        }
    });
    // Start Native Ads request.
    nativead.getAd();
}

@Override
protected void onDestroy() {
    nativead.destroy();
    super.onDestroy();
}

Class Reference

See also API Reference.