My Code:
final VunglePub vunglePub = VunglePub.getInstance();
[...]
final AdConfig globalAdConfig = vunglePub.getGlobalAdConfig();
[...]
final VungleAdEventListener vungleListener = new VungleAdEventListener(){
@Override
public void onAdEnd(String placementReferenceId, boolean wasSuccessfulView, boolean wasCallToActionClicked) {
Toast.makeText(Start.this, "1", Toast.LENGTH_SHORT).show();
}
@Override
public void onAdStart(String placemetReferenceId) {
Toast.makeText(Start.this, "2", Toast.LENGTH_SHORT).show();
}
@Override
public void onUnableToPlayAd(String placementReferenceId, String reason) {
Toast.makeText(Start.this, "3", Toast.LENGTH_SHORT).show();
}
@Override
public void onAdAvailabilityUpdate(String placementReferenceId, boolean isAdAvailable) {
Toast.makeText(Start.this, "4", Toast.LENGTH_SHORT).show();
}
};
[...]
onCreate:
// initialize Publisher SDK with app id, placement reference id list and init callback handler
vunglePub.init(this, "XXXXX", new String[] { "PLACEMEXXXXXX" }, new VungleInitListener() {
@Override
public void onSuccess() {
}
@Override
public void onFailure(Throwable e){
}
});
vunglePub.clearAndSetEventListeners(vungleListener);
globalAdConfig.setSoundEnabled(false);
globalAdConfig.setOrientation(Orientation.autoRotate);
vunglePub.playAd("PLACEMEXXXXX", globalAdConfig);
My App shows a vungle-ad, but I get not the Toasts "1" by onAdEnd from the vungleListener. I cant find my mistake
I found this explanation at this link
The method
onAdEnd
is called when the user leaves the ad and control is returned to your application.If
wasSuccessfulView
istrue
, the user watched the ad and should be rewarded (if this was a rewarded ad).If
wasCallToActionClicked
istrue
, the user clicked the call to action button in the ad.So, you must click on the Ad and return to your application to get the toast "1".