I am trying to use inMobi for a banner ad using these tutorials https://docs.coronalabs.com/tutorial/basics/ads/index.html
and https://docs.coronalabs.com/plugin/inmobi/index.html
In order for me to check to see if the ad is working I have to download my built apk file onto my phone and install it with a apk installer, but every time I open it there isn’t an ad.
Also nothing shows up in the console except inMobi.isLoaded () WARNING: The InMobi plugin is only supported on Android and iOS devices. Please build for device
inMobi.show () WARNING: The InMobi plugin is only supported on Android and iOS devices. Please build for device
inMobi.init () WARNING: The InMobi plugin is only supported on Android and iOS devices. Please build for device
inMobi.hide () WARNING: The InMobi plugin is only supported on Android and iOS devices. Please build for device
Is it possible that an ad is not showing because of my means of checking for an ad?
And why are the warnings the only thing that show in the console?
in my main.lua I have
local inMobi = require( "plugin.inMobi" ) local function adListener( event ) local json = require("json") print(json.prettify( event )) if ( event.phase == "init" ) then -- Successful initialization print( event.provider ) -- Load a banner ad inMobi.load( "banner", "1570204193336" ) elseif ( event.phase == "loaded" ) then -- The ad was successfully loaded print( event.type ) print( event.response ) print( event.placementId ) elseif ( event.phase == "failed" ) then -- The ad failed to load print( event.type ) print( event.placementId ) print( event.isError ) print( event.response ) elseif ( event.phase == "displayed" ) then -- Ads were loaded if event.type == "banner" then inMobi.load( "banner", { adUnitId = "1570204193336", hasUserConsent = true } ) elseif event.type == "rewardedVideo" then inMobi.load( "rewardedVideo", { adUnitId = myRewardedAdUnitId, hasUserConsent = true } ) end elseif ( event.phase == "reward" ) then -- A rewarded video was completed end end local myAppId = "1573753880392" local myBannerAdUnitId = "1570204193336" if "ios" == system.getInfo("platform") then myAppId = "your\_iOS\_AppId" myBannerAdUnitId = "YOUR\_IOS\_ADMOB\_BANNER\_AD\_UNIT\_ID" end inMobi.init( adListener, { accountId="bbba0556dbe34c4ea7107e24ae8815ec", appId = "1573753880392", testMode = true } ) if ( inMobi.isLoaded( "1570204193336" ) ) then -- Show the ad inMobi.show( "1570204193336", { yAlign="bottom" } ) end
In my start.lua where I want the ad to show
local inMobi = require( "plugin.inMobi" ) local placementID = "1570204193336" function scene:show( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then elseif ( phase == "did" ) then local adTimer = nil local adShowAttempts = 10 local function showAd() if adTimer then timer.cancel( adTimer ) end adShowAttempts = adShowAttempts - 1 if adShowAttempts \<= 0 then return end if not inMobi.isLoaded( "banner" ) then adTimer = timer.performWithDelay( 500, showAd ) else inMobi.show( "banner", {"1570204193336", y = "bottom" } ) end end adTimer = timer.performWithDelay( 100, showAd )