IronSource SDK native extension

#1

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.

11 Likes

Android build crashes when try to add Admob under IronSource mediation [SOLVED]
Issues with building native extension with 100mb+ files inside (SOLVED)
#2

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

#3

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

0 Likes

#4

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.

5 Likes

#5

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

3 Likes

#6

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.

3 Likes