Languages

Menu
Sites
Language
Problems applying InMobi ads in unity
//Banner Ads
using UnityEngine;
using System.Collections;
using Tizen.AdLib;
using System;


public class AdListener1 : BannerAdListener
{
    private AdProvider adobj;
    public AdListener1(AdProvider adobject)
    {
        adobj = adobject;
    }
    public void OnAdClicked(IntPtr handle)
    {
    }

    public void OnAdLoadFailed(IntPtr handle, ErrorType error)
    {
        adobj.BannerAdSetVisibility(handle, false);
    }

    public void OnAdLoadSucceeded(IntPtr handle)
    {
        adobj.BannerAdSetVisibility(handle, true);
    }
}


public class inmobiManager : MonoBehaviour {

    AdProvider adobject = AdProvider.Instance;

   
    // Use this for initialization
    void Start () {
        ErrorType result = adobject.InitAdlib("0cb220ea6e514f5894c1d51f12c22e9e", "_inmobi", "https://i.l.inmobicdn.net/sdk/jsac/p1/inmobi.js", "inmobi_conf"); // Your site ID from InMobi
        IntPtr adhandle;
        AdListener1 adListener = new AdListener1(adobject);
        result = adobject.AddBannerAd(BannerAdSize.BANNER_AD_SIZE_SMALL, out adhandle);
        result = adobject.BannerAdLoad(adhandle);
        result = adobject.BannerAdEnableAutoRefresh(adhandle, true);
        result = adobject.BannerAdSetPosition(adhandle, BannerAdPosition.BANNER_AD_POS_BOTTOM_CENTER);
        adobject.SetBannerAdListener(adhandle, adListener);
        result = adobject.BannerAdSetVisibility(adhandle, true);



    }
    
	// Update is called once per frame
	void Update () {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            adobject.DeinitAdlib();
            Application.Quit();
        }

    }
}

//Interstitial Ads
using UnityEngine;
using System.Collections;
using Tizen.AdLib;
using System;

public class AdListener : InterstitialAdListener
{
    public void OnAdLoadSucceeded(IntPtr handle)
    {
        Debug.Log("Entered in to OnAdLoadSucceeded handle is" + handle);
        AdProvider.Instance.InterstitialAdShow();
    }
    public void OnAdLoadFailed(IntPtr handle, ErrorType error)
    {
        Debug.Log("Entered in to OnAdLoadFailed");
    }
    public void OnAdOpened(IntPtr handle)
    {
        Debug.Log("Entered in to OnAdOpened handle is" + handle);
    }
    public void OnAdClosed(IntPtr handle)
    {
        Debug.Log("Entered in to OnAdClicked handle is" + handle);
    }
}



public class Paddle : MonoBehaviour {
    public float paddleSpeed = 1f;
	private Vector3 playerPos = new Vector3 (0f, -9.63f, 0f);
	AdProvider adobject = AdProvider.Instance;

	void Start () {
        adobject.InitAdlib("a1dfabc3a75a4a8a9145295710b26c2e", "_inmobi", "https://i.l.inmobicdn.net/sdk/jsac/p1/inmobi.js", "inmobi_conf"); // Your site ID from InMobi
        //IntPtr adhandle;
        AdListener myListener = new AdListener();
        ErrorType result = adobject.AddInterstitialAd();
        result = adobject.InterstitialAdLoad();
        result = adobject.SetInterstitialAdListener(myListener);
        result = adobject.InterstitialAdShow(); // Show the interstitial ad

    }///
    // Update is called once per frame
    void Update () {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            adobject.DeinitAdlib();
            Application.Quit();
        }

        float xPos = transform.position.x + (Input.GetAxis ("Horizontal") * paddleSpeed);
		playerPos = new Vector3 (Mathf.Clamp (xPos, -8f, 8f), -9.63f, 0f);
		transform.position = playerPos;
	}
}

 

Problems applying InMobi ads in unity. First, I am Korean and I am developing in Korea. I wanted to apply banner ads and interstitials to my application. In the case of Interstitial Ads, when I put my Site Id, I get a gray background instead of advertising. In the case of Banner Ads, using Test Site Id provided by InMobi will normally display the test banner. However, when I put my Site Id, the banner does not pop up. All of the testing was done on a Tizen Z3 device from an Indian server using RTL services. What did I do wrong? I've attached the code. Let me know what's wrong.

 

 

 

Edited by: 민성 김 on 07 Aug, 2017

Responses

5 Replies
André Reus

hi, have you followed these steps for activation of your account?

To start off, please follow the below steps to create account and register your app with Inmobi.

Step 1 - Send an email to tizen.onboarding@inmobi.com

Step 2 - You will receive a document stating the terms and conditions for app monetization with InMobi along with a list of details required for account creation and site id approval

Step 3 - Fill in the required details (only to be TYPED, not handwritten) and share a signed copy with InMobi. A scanned copy should be shared on the above mentioned email id and a hard copy should be mailed to the below mentioned address

  Legal Team, INMOBI, 7th Floor, Cessna Business Park,
  Kadubishanahalli, Sarjapur - Outer Ring Road,
  BANGALORE, KARNATAKA 560103
  India

Step 4 - Once the details are approved, the InMobi team will get back to you within 2 working days with account details and site id.

Step 5 - Proceed with technical integration as mentioned in the sections below

 

if not, please complete the steps. https://developer.tizen.org/development/tizen-studio/extension-sdk/inmobi-tizen-ad-sdk-programing-guide

And i am very much confusing if the InMobi working outside India! Hope you will get feedback from the given mail. Thanks

민성 김

I have already done all of the above steps.
So I activated my account and used my site id.

민성 김

I have already completed steps 1-4.
So I used my site id in step 5.
However, it still does not work for the same reasons I wrote in the article.

Kisung Son

Hello,


Looks like the issue with the siteID provided, as the test siteID works fine.

Also, test siteID donot work outside India for interstitial ads.

You can write to InMobi and check whether ads are available for the siteID provided(even if tested with RTL), and also outside India.

Please always check on error codes returned for the adlib APIs used.


Thanks.

Kisung Son

Hello,


Looks like the issue with the siteID provided, as the test siteID works fine.

Also, test siteID donot work outside India for interstitial ads.

You can write to InMobi(tizen.onboarding ⓐ inmobi.com) and check whether ads are available for the siteID provided(even if tested with RTL), and also outside India.

Please always check on error codes returned for the adlib APIs used.


Thanks.