3

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!

Hernan M.
  • 101
  • 3

2 Answers2

2

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.

Tangocoder
  • 637
  • 6
  • 16
  • I didn't use a banner yet, but I used a fullscreen (interstitial) Ad and it works fine, however you need an active property/application in order to actually see the ads working. – Tangocoder Mar 14 '14 at 19:01
  • I have an active property in inmobi – Hernan M. Mar 15 '14 at 01:16
2

I work for the InMobi Plugins team. The code you pasted above looks fine. So in case you are using an activated App ID, you should see the ads. Can you confirm that you have built the plugin using the XDK and are testing the build on the device?

In case you are testing on the device, Please enable the debug mode to view the logs by using the following code:

InMobiPlugin.ads.setLogLevel(2); // for debugging

The loglevel values are as follows:

1: default minimal log level.

2: log level used for debugging purposes.

3: log level used for critical debugging.

Connect the device to your laptop and check the logs on Xcode. Please send the logs to us at plugin-support@inmobi.com so that we can investigate further.

You can also enable the diagnostics mode for your App ID to receive test ads by following the instructions provided here: https://www.inmobi.com/support/art/23382291/21894911/setting-up-publisher-diagnostics/.

For further queries, please write to plugin-support@inmobi.com.