I'm struggling to integrate inmobi ads into my hybrid app (ios for now) built using Intelx XDK. I was following this guide: https://www.inmobi.com/support/art/23837226/22114287/intel-partner-platform-xdk-integration-guide/ but I had no luck. The integration does not even reach to the stage of firing an alert when the inmobiplugin.ready event occurs. When testing in the Intel xDK emulator it shows a js error:
Uncaught TypeError: Object [object Object] has no method 'registerLibrary' inmobiplugin.js:19
This is my code so far, very simple code for now, just for testing:
function onMobiReady(){
alert('inmobyReady');
alertSize();
InMobiPlugin.ads.initialize({appId:'My App ID'});
InMobiPlugin.ads.initBannerAd({appId:'My App ID', adSize:'ADSIZE_320X50',top:0,left:0,refreshInterval:30,animationType:'ANIMATION_CURLUP',refTagKey:'TAGKEY',refTagValue:'TAGVALUE',keywords:'cars'});
InMobiPlugin.getNewAd(document.getElementById('home_ads'));
}
document.addEventListener("inmobiplugin.ready",onMobiReady,false);
Does anybody have working code example of how to integrate inmobi ads using intel xdk ?
Thanks.
Edit:
This is the code I'm using:
var onDeviceReady=function(){
/* This code is used to run as soon as Intel activates */
intel.xdk.device.setRotateOrientation('portrait');
intel.xdk.device.setAutoRotate(false);
document.addEventListener("inmobiplugin.ready", onReadyM, false);
};
document.addEventListener("intel.xdk.device.ready",onDeviceReady,false);
function onReadyM()
{
alert('InMobiPlugin ready');
InMobiPlugin.ads.initialize({appId:'My APP ID'}); // Initialize to be called
// InMobi APIs can be called here
InMobiPlugin.ads.initBannerAd({appId:'My APP ID',adSize:'ADSIZE_320X50',top:200,left:0,refreshInterval:30,animationType:'ANIMATION_OFF', test:true, refTagValue:'TAGVALUE'});
InMobiPlugin.ads.setAdRequestProperties({gender:'GENDER_MALE',income:30000,education:'EDUCATION_BACHELORS_DEGREE',age:30,hasChildren:TRUE,language:'English'});
InMobiPlugin.ads.loadBannerAd();
}
I can see the alert 'InMobi Plugin ready'
but I see no adds. Its a simple html page, just for testing.
Do you have any hints ?
thanks a lot!
Actually the InMobi plugin won't work in Intel XDK, but it will work when you build the app, and this is the case for any XDK plugin.
One more thing, you should register the inmobiplugin.ready event on device ready not before.
EDIT
If the event inmobiplugin.ready is fired and you saw the alert, then your setup is correct.
However, InMobi will not serve advertisements till your property/application is approved & activated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With