Simple infeed advertising

Simple implementation is possible when using the view components, including ListView and ArrayAdapter.

Displaying simple infeed advertising

Implement the following using RFPInstreamAdAdapter to display infeed advertising.

// (1) Importing the necessary packages
import jp.fout.rfp.android.sdk.RFP;
import jp.fout.rfp.android.sdk.instream.ADVSInstreamAdAdapter;

public class MyActivity extends Activity {

    // (2) RFPInstreamAdAdapter definition
    private RFPInstreamAdAdapter<ArrayAdapter> rfpAdapter;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        ...
        // (3) Initialization of RFP SDK
        RFP.init(this, "YOUR_MEDIA_ID");
        ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this, R.layout.rowdata, data);

        // (4) Set the adapter you want to insert infeed advertising for and the advertising framework Id
        advsAdapter = RFP.createInstreamAdAdapter(this, arrayAdapter, "YOUR_ADSPOT_ID");
        ...
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        ...
        listView = (ListView) frameLayout.findViewById(R.id.listView);

        // (5) Set the adapter for the list view for which you want to insert the infeed advertising
        listView.setAdapter(advsAdapter);
        ...
    }
    ...
    // Wait for media data acquisition to complete
    ...
    // (6) Start loading the infeed ads
    rfpAdapter.loadAd();
}

The advertising cases per request and advertising position array can be controlled using API, such as RFP createInstreamAdAdapter(Context context, T originalAdapter, String adSpotId, int adCount, List<Integer>positions).

Acquire event when displaying simple infeed advertising

You may want to receive this event when infeed advertisements are displayed.

In this case, set RFPInstreamAdLoadListener in RFPInstreamAdAdapter.

RFPInstreamAdAdapter adapter;
RFPInstreamAdLoadListener listener;

//(1) Set listener in RFPInstreamAdAdapter
adapter.setAdListener(listener);

listener = new RFPInstreamAdLoadListener() {

    //(2) When starting advertisement loading
    @Override
    public void instreamAdLoaderDidStartLoadingAd() {
    }
    //(3) When completing advertising loading
    @Override
    public void instreamAdLoaderDidFinishLoadingAds() {
    }
    //(4) When completing loading of the main advertising View screen
    @Override
    public void instreamAdLoaderDidFinishLoadingMainImage(String imageUrl) {
    }
    //(5) When advertising loading fails
    @Override
    public void instreamAdLoaderDidFailToLoadAdError(String errorString) {
    }
    //(6) When advertising View loading fails
    @Override
    public void instreamAdLoaderDidFailToLoadImageError(String errorString) {
    }
    //(7) When advertising click processing completes
    @Override
    public void instreamAdLoaderDidClick(String redirectUrl) {
    }
};

Additional loading of simple infeed advertising

In the case of a UI in which an additional feed is loaded when the user arrives at the bottom section of the site, it is possible to load additional advertising.

public void loadMore() {
    // Load additional advertising and insert in the appropriate position within the table based on the advertising position array
    advsAdapter.loadAd();
}

Usable simple infeed advertising format

  • 1-1) ThumbnailMiddle
    // The format looks like this
    //  -----------------------------------------------------
    // |             |  name                                 |
    // |   image     |  ad text                              |
    // |             |                                       |
    // |   90x90     |                                       |
    // |             |                                    PR |
    //  -----------------------------------------------------
  • 1-2) ThumbnailSmall
    // The format looks like this
    //  -----------------------------------------------------
    // |  -------    name                                    |
    // | | image |   PR                                      |
    // | | 50x50 |   ad text                                 |
    // | |       |                                           |
    // |  -------                                            |
    //  -----------------------------------------------------
  • 1-3) LandscapePhoto
    // The format looks like this
    //  -----------------------------------------------------
    // |                                                     |
    // |                  ad image                           |
    // |                                                     |
    // | --------------------------------------------------- |
    // |  ad text                                            |
    // |                                                     |
    // |                                                     |
    // |                                                 PR  |
    // |  advertiser name                                    |
    //  -----------------------------------------------------
  • 1-4) PhotoBottom
    // The format looks like this
    //  -----------------------------------------------------
    // |  advertiser name                                    |
    // |  PR                                                 |
    // |  ad text                                            |
    // | --------------------------------------------------- |
    // |                                                     |
    // |                                                     |
    // |                   image                             |
    // |                                                     |
    //  -----------------------------------------------------
  • 1-5) PhotoMiddle
    // The format looks like this
    //  -----------------------------------------------------
    // | name                                                |
    // |                                                  PR |
    // | --------------------------------------------------- |
    // |                                                     |
    // |                                                     |
    // |                      image                          |
    // |                                                     |
    // |                                                     |
    // |                                                     |
    // | --------------------------------------------------- |
    // |  text                                               |
    //  -----------------------------------------------------
  • 1-6) TextOnly
    // The format looks like this
    //  -----------------------------------------------------
    // |  name                                               |
    // |                                                  PR |
    // | --------------------------------------------------- |
    // |                                                     |
    // |             ad text                                 |
    // |                                                     |
    // |                                                     |
    //  -----------------------------------------------------
  • 1-7) WebView

By drafting HTML, it is possible to portray this in WebView within the app.