Simple implementation is possible when using the view components, including ListView and ArrayAdapter.
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)
.
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) {
}
};
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();
}
// The format looks like this
// -----------------------------------------------------
// | | name |
// | image | ad text |
// | | |
// | 90x90 | |
// | | PR |
// -----------------------------------------------------
// The format looks like this
// -----------------------------------------------------
// | ------- name |
// | | image | PR |
// | | 50x50 | ad text |
// | | | |
// | ------- |
// -----------------------------------------------------
// The format looks like this
// -----------------------------------------------------
// | |
// | ad image |
// | |
// | --------------------------------------------------- |
// | ad text |
// | |
// | |
// | PR |
// | advertiser name |
// -----------------------------------------------------
// The format looks like this
// -----------------------------------------------------
// | advertiser name |
// | PR |
// | ad text |
// | --------------------------------------------------- |
// | |
// | |
// | image |
// | |
// -----------------------------------------------------
// The format looks like this
// -----------------------------------------------------
// | name |
// | PR |
// | --------------------------------------------------- |
// | |
// | |
// | image |
// | |
// | |
// | |
// | --------------------------------------------------- |
// | text |
// -----------------------------------------------------
// The format looks like this
// -----------------------------------------------------
// | name |
// | PR |
// | --------------------------------------------------- |
// | |
// | ad text |
// | |
// | |
// -----------------------------------------------------
By drafting HTML, it is possible to portray this in WebView within the app.