Open netlogica opened 3 days ago
@netlogica
What version of the plugin do you think this problem occurs in? and this problem does not occur in what version
Unfortunately I don't have an apple developer account, so I can only test in xcode.
And I noticed that your code has some errors, like I have to make a sample code including documentation for iOS and android simple, Maybe in the next day or two.
In the next release, I will update the code to send an error response to the event block, so it's easier to find out what the problem is.
// example of the next release
document.addEventListener('on.interstitial.failed.load', (event) => {
console.log("ERROR on interstitial Ad loaded", JSON.stringify(event));
});
document.addEventListener('on.interstitial.failed.show', (event) => {
console.log("ERROR on interstitial Ad show", JSON.stringify(event));
});
@EMI-INDO
Thank you for reply: a sample code for intertitial implementation and a catch for error response on next version of your plugin is very useful.
@netlogica
What version of the plugin do you think this problem occurs in? and this problem does not occur in what version
The versions of plugin I tested show the same behavior, they are 1.4.9 and 1.5.3: on both I see test ADS but not the production one.
In the meantime, while you make the implementation example into the documentation, I made a (dirty) workaround and ads will show into 1 minute.
// Initizlize, load and show interstitial ads
function setAdMob() {
console.log('begin setAdMob');
// Remove existing event listeners before adding them
document.removeEventListener('on.interstitial.loaded', onInterstitialLoaded);
document.removeEventListener('on.interstitial.failed.show', onInterstitialFailedShow);
const config_globalSettings = {
setAppMuted: false,
setAppVolume: 1.0,
publisherFirstPartyIdEnabled: false,
npa: 1,
enableCollapsible: false,
responseInfo: false,
setDebugGeography: false
}
const config_initializeSettings = {
isUsingAdManagerRequest: false,
isResponseInfo: true,
isConsentDebug: true
}
cordova.plugins.emiAdmobPlugin.globalSettings(config_globalSettings);
cordova.plugins.emiAdmobPlugin.initialize(config_initializeSettings);
var interstitialIdUnit = 'ca-app-pub-3940256099942544/1033173712';
const config_Interstitial = {
adUnitId: interstitialIdUnit,
autoShow: false
};
cordova.plugins.emiAdmobPlugin.loadInterstitialAd(config_Interstitial);
// add event listener
document.addEventListener('on.interstitial.loaded', onInterstitialLoaded);
document.addEventListener('on.interstitial.failed.show', onInterstitialFailedShow);
}
// Function to manage interstitial loading
function onInterstitialLoaded() {
setTimeout(function() {
cordova.plugins.emiAdmobPlugin.showInterstitialAd();
}, 1000);
}
// Function to handle failure of interstitial display and reload if show fail
function onInterstitialFailedShow(data) {
setTimeout(function() {
removeTimer();
setAdMob(); // recursive call
}, 1000);
}
// Clear all setTimeouts and setInterval
function removeTimer() {
let id = window.setTimeout(() => {}, 0);
while (id--) {
window.clearTimeout(id);
}
id = window.setInterval(() => {}, 0);
while (id--) {
window.clearInterval(id);
}
}
In this way, after about 50 seconds, the ads with production unit-id shown.
I contacted Google AdMob support so I will insert their reply here, as soon as they have answered me, so that they - I hope - can be useful to others.
Thanks again, I await your doc update with example for the correct implementation of interstitial ads on 1.5.3. version.
Greetings from Italy
Mario
@netlogica
Release summary, and how to install https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/releases/tag/v.1.5.4
simple example https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/tree/main/Example/www
You should pay attention to which old flames are no longer in use, especially globalSettings, targeting https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/blob/main/Example/www/js/deviceready.js
@EMI-INDO Thank you very much for new release and for implementation example (very important).
I will be able to do some tests in the next 24 hours to give feedback. For now, with only your testing code and with my production unit-id I see on console "Request Error: no ad to show" but with test id work like a charm. In my previous workaround, with recursive recall on fail with a sleep of 1 second, ads production show after 40-50 seconds. Very strange...
I await AdMob support reply (I hope by 1 or 2 day) to update this thread with new information.
Anyway, thank you for your availability, I will send you a "beer" on Paypal :)
Mario software [at] netlogica.it
@netlogica
Thank you for the “beer”
I recommend you to create a new interstitial adUnitId
https://groups.google.com/g/google-admob-ads-sdk/c/1YonZJ3No4Y
Note Be careful in this case, ad serving in your app may be restricted.
I always remind anyone in the documentation.
/ https://support.google.com/admob/answer/9493252?hl=en Best practice when using ad original ID unit, the app must be uploaded to the play store or app store, and you must upload it from there, otherwise you may be subject to ad serving restrictions, if it happens often, it is possible that your admob account will be permanently disabled. /
Bug report
[ ] I confirm this is a suspected bug or issue that will affect other users
[X] I have read the documentation thoroughly and it does not help solve my issue.
[X] I have checked that no similar issues (open or closed) already exist.
Current behavior:
On my Android and iOS application (with previous version of plugin emi-indo-cordova-plugin-admob 1.4.8) from 19 october 2024 the insterstitial ads show only if I set a Google AdMob test unit id - ca-app-pub-3940256099942544/1033173712- and nothing with my production ads unit-id ((which worked fine until October 19 2024).
My environment is: MaxOS Sonoma 14.6.1 Xcode 15.4 cordova 13.0.0 node 20.16.0 Cocoapods 1.16.0 Running cordova-ios@7.1.1
Updated to the plugin version 1.5.4 the result is the same: with the test unit id the interstitial ads banner is displayed; with the production unit id I get an error on console (below is the execution console log on the simulator, but it is similar on a physical iPhone).
I would like to point out that the app is always correctly published on the Apple Store, that the app-ads.txt file is always present, and that the app is approved on AdMob (see attached images) and Unit-id correctly defined (until October 19 the ads will be displayed correctly)..
To make a test, I created with cordova an app called test where I installed only the emi-indo-cordova-plugin-admob 1.5.3 plugin with app id production and inserted the following javascript to instantiate the object and call the insterstitial banner:
My config.xml is:
Opening app on Xcode with ".xcworkspace" file, I can build without errors. On console:
Please, can you help me with this? Has anyone had the same issue?
Thank you all,
Mario