hello guys,
Im new here, and i get the code for both, inters and rewards :but it s not working i don t know why ?
and i did a showrewards and inter in my init.js file but nothing's happening .
Any ideas,
FYI : my Audience network mark it s not green i don t know why maybe is it the problème ??
//*=================================================*//
//*-------------------------------------------------*//
//*----------------- Facebook ----------------------*//
//*--------------- Instant Game --------------------*//
//*--------------- AdsController -------------------*//
const INTERSTITIAL_PLACEMENT_ID = 'xx'; //*-------- Interstitial -------*//
const REWARDED_PLACEMENT_ID = 'xx'; //*-------- Rewarded Video -----*//
// LoadRewarded();
// LoadInter();
// ShowRewarded();
// ShowInter();
var preloadedRewardedVideo;
var preloadedInterstitial;
//*=================================================*//
//*-------- Interstitial ADS By edward -------*//
//*=================================================*//
//*-------- Load Interstitial --------*//
function LoadInter() {
var supportedAPIs = FBInstant.getSupportedAPIs();
if (supportedAPIs.includes('getInterstitialAdAsync')){
preloadedInterstitial = null;
FBInstant.getInterstitialAdAsync(
INTERSTITIAL_PLACEMENT_ID,
).then(function(interstitial) {
preloadedInterstitial = interstitial;
return preloadedInterstitial.loadAsync();
}).then(function() {
console.log('Interstitial preloaded')
}).catch(function(err){
console.error('Interstitial failed to preload: ' + err.message);
});
} else {
displayError('Ads not supported in this session');
}
}
//*-------- Show Interstitial --------*//
function ShowInter() {
preloadedInterstitial.showAsync()
.then(function () {
console.log('Interstitial ad finished successfully');
})
.catch(function (e) {
console.error(e.message);
});
}
//*=================================================*//
//*-------- Rewarded Video ADS By edward-----*//
//*=================================================*//
//*-------- Load Rewarded --------*//
function LoadRewarded() {
var supportedAPIs = FBInstant.getSupportedAPIs();
if (supportedAPIs.includes('getRewardedVideoAsync')){
preloadedRewardedVideo = null;
FBInstant.getRewardedVideoAsync(
REWARDED_PLACEMENT_ID
).then(function(rewarded) {
preloadedRewardedVideo = rewarded;
return preloadedRewardedVideo.loadAsync();
}).then(function() {
console.log('Rewarded Video preloaded')
}).catch(function(err){
console.error('Rewarded Video failed to preload: ' + err.message);
});
} else {
displayError('Ads not supported in this session');
}
}
//*-------- Show Rewarded --------*//
function ShowRewarded() {
preloadedRewardedVideo.showAsync()
.then(function () {
console.log('Rewarded Video ad finished successfully');
})
.catch(function (e) {
console.error(e.message);
});
}
//*=================================================*//
//*-------------------------------------------------*//
//*----------------- Facebook ----------------------*//
//*--------------- Instant Game --------------------*//
//*--------------- AdsController -------------------*//
//*-------------- edward------------------*//
//*-------------------------------------------------*//
//*=================================================*//