This chapter will explain the procedure for displaying the advertisement in the application and measuring the effectiveness of the advertisement.
For the details, please refer to 3.Programming Guide.
build.gradle
to install RFP Android SDK and Google Play Services SDK.repositories {
maven { url 'https://raw.github.com/fout/RFP-Android-SDK/master/repos/' }
}
dependencies {
implementation 'jp.fout.rfp.android.sdk:rfp-sdk:x.x.x'
implementation 'com.google.android.gms:play-services-base:11.0.+'
}
For the details, please refer to Installtion Guide.
adSpotId
) .
(At the current stage, inquiries should be made to the representative)Media ID uses the app identification.
Advertising framework ID (adSpotId
) is a unique identifier used to distinguish an advertisement framework,
See Acquisition of advertising framework ID for details on advertising framework ID.
RFP SDK is initialized with the Media ID acquired as described above as the argument.
RFP.init(this.getApplicationContext(), "YOUR_MEDIA_ID");
Please note that unless initialization takes place, the general acquisition of advertisements, to be described later, cannot be performed.
Create RFPInstreamAdPlacer
instance, and call loadAd()
to load advertisements.
Set RFPInstreamAdPlacerListener
to get callback.
RFPInstreamAdPlacer adPlacer;
RFPInstreamAdPlacerListener listener;
adPlacer = RFP.createInstreamAdPlacer(getActivity().getApplicationContext(), "YOUR_ADSPOT_ID");
adPlacer.setAdListener(new RFPInstreamAdPlacerListener() {
// callback from the loadAd()
public void onAdsLoaded(List<? extends RFPInstreamInfoModel>items) {
}
});
// start to load advertisement
adPlacer.loadAd();
The metadata information of the advertisement is in the RFPInstreamInfoModel
, and build the advertisement’s view based on this.
void setData(RFPInstreamInfoModel data) {
advertiserName.setText(data.title());
adText.setText(data.content());
String displayedAdvertiser = data.displayedAdvertiser();
if (null != displayedAdvertiser && 0 < displayedAdvertiser.length()) {
adSponsoredLabel.setText(displayedAdvertiser);
}
(new ImageLoader(data.creative_url(), adImage)).execute();
}
For measuring the advertisement’s, it is necessary to notify the events of the advertisement.
Action | Notify Timing |
---|---|
impression | when advertisement’s display is completed |
click | when advertisement is clicked |
After advertisement displayed, please call the following method to send impression event.
measureImp(RFPInstreamInfoModel adItem);
When the advertisement is clicked, user is appropriately transitioned by calling the following method.
sendClickEvent(RFPInstreamInfoModel adItem);
Advertisement’s clicked notification will be posted to RFPInstreamAdPlacerListener onAdClicked
.
In order to guarantee that advertisements are viewable, this SDK recommends viewable impression. Advertisement’s viewable impression must satisfy the impression conditions and must satisfy the following.
Advertisement’s type | conditions |
---|---|
Display ads | condition1. at least 50% of the advertisement is visible condition2. visible for at least 1 second |
Video ads | condition1. at least 50% of the advertisement is visible condition2. visible for at least 2 consecutive seconds |
More details, please refer to JIAA(Japanese), and IAB/MRC(English).