如何将InMobi广告集成到Android手机差距应用中。我找不到任何东西。
InMobi是否有任何Android插件?有没有人已经实现了InMobi android手机差距应用程序?我尝试了这段代码,但这不起作用

var userIP = "115.246.164.46";
var useragent = "Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L Build/IML74K) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30";
$.ajax({
    url: "http://api.w.inmobi.com/showad/v2",
    type: 'POST',
    contentType: "application/json charset=utf-8",
    data: {
        "responseformat": "axml",
        "imp": [{
            "ads": 1,
            "adtype": "int",
            "banner": {
                "adsize": 14,
                "pos": "top",
                "api": 1
            }
        }],
        "site": {
            "id": "e702096c879446f39755da0e81b1d5c5"
        },
        "device": {
            "ip": userIP,
            "ua": useragent
        }
    },
    success: function(d) {
        alert(d);
    },
    error: function(request, status, error) {
        alert(error);
    }
});

最佳答案

您需要inmobi.js并尝试以下代码:

  var inmobi_conf =
  {
    siteid : "4028cba631d63df10131e1d3191d00cb", // your Property ID
    slot: 15,
    test: true,
    manual: true,
    autoRefresh: 60,
    targetWindow : "_blank",
    onError : function(code)
    {
      if(code == "nfr")
      {
        console.log("Error getting the ads!");
      }
    }
  };

  document.addEventListener("deviceready", onDeviceReady, false);

  function onDeviceReady()
  {
    console.log('device ready');
    $.getScript("inmobi.js", function(){
      showAds();
    });
  }

  function showAds()
  {
    var adsElement = document.getElementById('the id of the DOM element for displaying the ads');
    _inmobi.getNewAd(adsElement);
  }

10-08 12:08