@Jacowaco Thank you very much for all the help and contribution, much appreciated.
@starlingnoob
Problem 1) As Jacowaco explained
Problem 2) Yes the cache method is not available in Android. But i recently updated the extension resolving a similar issue in iOS, so i did standardize the Android and iOS operation for the Interstitial.
The process is:
- Init the extension
/**
* Manager initializer
* If a context is not available a new context will be created
*
* @param testMode true if test mode, false if production mode. Optional, Default = true
* @param verbose When activated, the class will trace information about the operation. Optional, Default = true
*/
static public function init(testMode:Boolean = true, verbose:Boolean = true):void
{
// get the manager instance
mAdMobManager = AdMobManager.manager;
// Initialize the ANE Extension if it is supported
if(adMobManager.isSupported){
// Set te vebose mode
adMobManager.verbose = verbose;
// Set Operation mode
if (testMode) adMobManager.operationMode = AdMobManager.TEST_MODE;
else adMobManager.operationMode = AdMobManager.PROD_MODE;
// Set AdMobId settings
if (isIOS){
adMobManager.bannersAdMobId = Constants.ADMOB_BANNER_IOS;
adMobManager.interstitialAdMobId = Constants.ADMOB_INTERSTITIAL_IOS;
}else{
adMobManager.bannersAdMobId = Constants.ADMOB_BANNER_AND;
adMobManager.interstitialAdMobId = Constants.ADMOB_INTERSTITIAL_AND;
}
addEventsListeners();
}else{
Root.log(LOG_TAG,"AdMob Is not Supported");
}
}
- Add the event listener for the interstitial
/**
* Add all the event Listeners
*
*/
static private function addEventsListeners():void
{
// onInterstitialLoaded Event Listener
if (!dispatcher.hasEventListener(AdMobEvent.INTERSTITIAL_LOADED))
dispatcher.addEventListener(AdMobEvent.INTERSTITIAL_LOADED, onInterstitialLoaded);
// onInterstitialFailedToLoad Event Listener
if (!dispatcher.hasEventListener(AdMobEvent.INTERSTITIAL_FAILED_TO_LOAD))
dispatcher.addEventListener(AdMobEvent.INTERSTITIAL_FAILED_TO_LOAD, onInterstitialFailedToLoad);
}
- Add their listeninf function
/**
* onInterstitialLoaded Event listener
*
* @param e AdMobEvent Object
**/
private function onInterstitialLoaded(e:AdMobEvent):void
{
// Debug Logger
Root.log(LOG_TAG,"onInterstitialLoaded");
// The inter is loaded update a boolean for your application
// so you know that the Inter is ready to be show
mInterReady = true;
}
/**
* onInterstitialFailedToLoad Event listener
*
* @param e AdMobEvent Object
**/
private function onInterstitialFailedToLoad(e:AdMobEvent):void
{
// Debug Logger
Root.log(LOG_TAG,"onInterstitialFailedToLoad");
// If it fails destroy the Interstitial
if(adMobManager.isSupported) adMobManager.removeInterstitial();
// Then you can retry to recreat it, you can also add a counter for retry
}
4. Create the Interstitial passing false for autoshow, so it is created but not visible/show
/**
* Create the Interstitial Ad
*/
static public function createInterstitial(autoshow:Boolean = true):void
{
// Debug Logger
Root.log(LOG_TAG,"createInterstitial");
// Create the Interstitial
if(adMobManager.isSupported) adMobManager.createInterstitial(null,autoshow);
}
- When you want to actually swow the Interstitial you call the show method
/**
* Show the Interstitial Ad
*
*/
static public function showInterstitial():void
{
// Debug Logger
Root.log(LOG_TAG,"showInterstitial");
// Show the Interstitial
if(adMobManager.isSupported) adMobManager.showInterstitial();
}
This procedure will be common for iOs and Android.
3) bannersAdMobId = AdMobId for Banners, interstitialAdMobId = AdMobId for interstitial.
You can assign a different id for android or ios according to the device in use (see above)
I just update the extension in GitHub, and i also added a full application with the source code.
All this example and implementation are available in the source code. Please check it out.
Please let me know if it helps.