Hi,
I am trying to use the Admob Ionic Native 3 plugin to implement rewarded video.
The challenge is knowing when the user has accepted the ad and when to give the user rewards.
For the Cordova plugin directly, i would have done something like this(from the docs)
document.addEventListener('onAdPresent', function(data){
if(data.adType == 'rewardvideo') {
console.log( data.rewardType );
console.log( data.rewardAmount );
}
});
With Ionic Native, i am trying this in my IonViewDidLoad method
ionViewDidLoad() {
this.adMob.onAdPresent()
.subscribe((data) => {
console.log('ad present: ' + data.adType + ";" + JSON.stringify(data));
if (data.adType == 'rewardvideo') {
//console.log("Rewarded:" + data.rewardType + " - " + data.rewardAmount);
//Award coins
}
});
}
But its not triggering at all.
I have added the same code to my app.component.ts file just incase, and so it can be added only once.
But its still not triggering. Can anybody help?