IronSource SDK native extension

Here is an extension with partial implementation of IronSource SDK for Defold: https://github.com/MaratGilyazov/def_ironsource

DISCLAIMER
To be honest I have no idea what I’m doing here (as well, as in the Tenjin Extension ) - I’m not either a C++ programmer or Objective-C programmer, don’t know how native iOS apps work and the whole extension for 80% was copy-pasted from Unity Ads Extension. It seems working and enough for my needs, but if you want to use it - use it at your own risk.

Android support implemented by @AlexeyFeskov

IronSource is a well known monetization/mediation ad network. In current implementation only Interstitial and Rewarded Ads are supported, Banners are not. Also, I’m going to add other networks for mediation, but going to keep master branch with clear IS implementation.

if ironsource then
	ironsource.init("your_app_key", true)
	ironsource.set_callback(ironsource_callback)
	ironsource.validate_integration()
	ironsource.load_interstitial()
end

if ironsource and ironsource.is_interstitial_ready() then
	ironsource.show_interstitial()
end

if ironsource and ironsource.is_rewarded_ready() then
	ironsource.show_rewarded()
end

function ironsource_callback(self, message_type, message)
	if message_type == ironsource.INTERSTITIAL_DID_LOAD then
		print("ironsource_callback: INTERSTITIAL_DID_LOAD")
	elseif message_type == ironsource.INTERSTITIAL_DID_SHOW then
		print("ironsource_callback: INTERSTITIAL_DID_SHOW")
	elseif message_type == ironsource.INTERSTITIAL_DID_CLICK then
		print("ironsource_callback: INTERSTITIAL_DID_CLICK")
	elseif message_type == ironsource.INTERSTITIAL_DID_CLOSE then
		print("ironsource_callback: INTERSTITIAL_DID_CLOSE")
		ironsource.load_interstitial()
	elseif message_type == ironsource.INTERSTITIAL_DID_OPEN then
		print("ironsource_callback: INTERSTITIAL_DID_OPEN")
	elseif message_type == ironsource.INTERSTITIAL_DID_FAIL_TO_SHOW then
		print("ironsource_callback: INTERSTITIAL_DID_FAIL_TO_SHOW")
		ironsource.load_interstitial()
	elseif message_type == ironsource.INTERSTITIAL_DID_FAIL_TO_LOAD then
		print("ironsource_callback: INTERSTITIAL_DID_FAIL_TO_LOAD")
		
	elseif message_type == ironsource.REWARDED_AVAILABLE then
		print("ironsource_callback: REWARDED_AVAILABLE")
	elseif message_type == ironsource.REWARDED_NOT_AVAILABLE then
		print("ironsource_callback: REWARDED_NOT_AVAILABLE")
	elseif message_type == ironsource.REWARDED_DID_COMPLETE then
		print("ironsource_callback: REWARDED_DID_COMPLETE")
	elseif message_type == ironsource.REWARDED_DID_FAIL then
		print("ironsource_callback: REWARDED_DID_FAIL")
	elseif message_type == ironsource.REWARDED_DID_OPEN then
		print("ironsource_callback: REWARDED_DID_OPEN")
	elseif message_type == ironsource.REWARDED_DID_CLOSE then
		print("ironsource_callback: REWARDED_DID_CLOSE")
	elseif message_type == ironsource.REWARDED_DID_CLICK then
		print("ironsource_callback: REWARDED_DID_CLICK")
	elseif message_type == ironsource.REWARDED_DID_START then
		print("ironsource_callback: REWARDED_DID_START")
	elseif message_type == ironsource.REWARDED_DID_END then
		print("ironsource_callback: REWARDED_DID_END")
	end
end

For more details, integration docs and code examples see extension’s github page.

13 Likes

Make pull request with Android support https://github.com/MaratGilyazov/def_ironsource/pull/1
… and with same Disclaimer - I’m not a Java / C++ programmer :wink::crossed_fingers: 80% was copy-pasted from Unity Ads Extension

5 Likes

Merged, tested, seems working, thanks! :+1:

Just tested IronSource extension with 6 Ad networks under mediation on iOS:

  • Ironsource itself,
  • Admob,
  • Facebook,
  • UnityAds,
  • Vungle,
  • Applovin

Interstitials and Rewarded Ads are working for all networks. Pushing new build to the AppStore :crossed_fingers:

As for Android - facing some issues with Admob, good-old fun with resolving libraries dependencies :grimacing: Other networks seems working.

7 Likes

Added to the Asset Portal: https://defold.com/assets/ironsource/

3 Likes

Extension version 1.2 released:

  • updated IS SDK from 6.14.0 to 6.15.0
  • consent parameter is now optional in init(key, consent) method
  • separate set_consent(consent) method

P.S. iOS build with IS and 5 networks under mediation was released on AppStore at 5th of March - everything looks OK so far.

4 Likes

Is it still OK?

Any plan to add the BANNER format?
Would be much appreciated.

Hi, I don’t have plans to update this extension in near future because I’ve stepped out from developing on Defold (Unity just fits better my actual business needs, nothing personal, defolders :heart:). So feel free to fork it and do whatever you want with the sources. Good luck :+1:

5 Likes

@marat.giliazov How do you integrate other networks as part of the mediation?
I understand I need to integrate other SDKs, but how to link them ironsource?
Is there any example available for this?

I’m trying to integrate Facebook Ads through mediation.

Here is the extension grade file

repositories {
	// https://developers.ironsrc.com/ironsource-mobile/android/android-sdk/#step-1
    maven {
        url "https://dl.bintray.com/ironsource-mobile/android-sdk"
    }
    maven {
        url  "https://android-sdk.is.com/"
    }
}

dependencies {
	// https://developers.ironsrc.com/ironsource-mobile/android/android-sdk/#step-1
    implementation 'com.ironsource.sdk:mediationsdk:6.15.0@jar' 
    implementation 'com.facebook.android:audience-network-sdk:6.4.0'
}

The build fails when merging manifest:

SEVERE: /tmp/.gradle/unpacked/com.facebook.android-audience-network-sdk-6.4.0.aar/AndroidManifest.xml:12:9-55 Error:
	Missing 'package' key attribute on element package at AndroidManifest.xml:12:9-55
May 13, 2021 9:05:13 AM com.defold.manifestmergetool.ManifestMergeTool$ILoggerWrapper error
SEVERE: /tmp/.gradle/unpacked/com.facebook.android-audience-network-sdk-6.4.0.aar/AndroidManifest.xml Error:
	Validation failed, exiting
May 13, 2021 9:05:13 AM com.defold.manifestmergetool.ManifestMergeTool$ILoggerWrapper warning
WARNING:
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

May 13, 2021 9:05:13 AM com.defold.manifestmergetool.ManifestMergeTool main
SEVERE: java.lang.RuntimeException: Failed to merge manifests: com.android.manifmerger.MergingReport@6c49835d

I seem to be missing something. Can anyone help?

This sounds familiar. It could be related to the version of the Android build tools or something like that. Which version of Defold are you using?

Yep, it seems to be the case:

Please let us know which version of Defold you are using!

I’m using 1.2.180.

Here’s a forum post with a user experiencing the same thing: Several Android-specific questions, while integrating Ads Mediation (15+ networks)

I believe the problem is that we are using an old version of the manifest merge tool from Google. We use version 26.0.0:

But there are newer versions available:

https://mvnrepository.com/artifact/com.android.tools.build/manifest-merger?repo=google

I’ve created a ticket to track this issue: https://github.com/defold/extender/issues/198

1 Like

Thanks for looking into it. Is there any temporary work around we can use?

The only thing I can think of is to use an older version of dependencies or that you set up a local build server.

But I’ll try to take a look at this next week!

Looking into this now!

1 Like

PR: Updated to newer version of the Android manifest merge tool by britzl · Pull Request #199 · defold/extender · GitHub