Skip to content

Mediation support for android (except Chartboost)#59

Merged
AGulev merged 5 commits into
masterfrom
mediation
Jan 26, 2026
Merged

Mediation support for android (except Chartboost)#59
AGulev merged 5 commits into
masterfrom
mediation

Conversation

@AGulev

@AGulev AGulev commented Jan 18, 2026

Copy link
Copy Markdown
Contributor

To reduce scope of the issue I decided to ship Android support for now (except Chartboost, because it's blocked by defold/extender#385)

Partially implements support for this task #31

@AGulev AGulev changed the title Mediation supoort Mediation support Jan 18, 2026
@britzl

britzl commented Jan 24, 2026

Copy link
Copy Markdown
Contributor

Please also add some information to the documentation about the complexities of configuring and testing adapters (I'm thinking of your comments here: https://forum.defold.com/t/admob-mediation-bidding-in-defold-are-we-limited-to-a-small-set-of-supported-networks/82239/5?u=britzl)

@AGulev AGulev changed the title Mediation support Mediation support for android (except Chartboost) Jan 26, 2026
@AGulev AGulev requested a review from britzl January 26, 2026 14:38
@AGulev

AGulev commented Jan 26, 2026

Copy link
Copy Markdown
Contributor Author

@britzl this PR is ready for review. For now only Android

Comment thread .gitignore
/debug.keystore.pass.txt
/.editor_settings
/.vscode
*.eclipse.buildship.core.prefs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zed adds such files when edit java

@@ -1,11 +1,98 @@
// Auto-generated by updater/android.py. Do not edit by hand.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generator is the key here, it helps to reduce maintenance burden

@@ -1,2 +1,67 @@
# Auto-generated by updater/ios.py. Do not edit by hand.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I keep it here, because it will not be used anyways (without checkboxes in game.project I removed from ext.properties)

jmethodID jni_constructor = env->GetMethodID(cls, "<init>", "(Landroid/app/Activity;Ljava/lang/String;Ljava/lang/String;)V");
g_admob.m_AdmobJNI = env->NewGlobalRef(env->NewObject(cls, jni_constructor, threadAttacher.GetActivity()->clazz, jappOpenAdUnitId, jdefoldUserAgent));
jmethodID jni_constructor = env->GetMethodID(cls, "<init>", "(Landroid/app/Activity;Ljava/lang/String;Ljava/lang/String;Z)V");
g_admob.m_AdmobJNI = env->NewGlobalRef(env->NewObject(cls, jni_constructor, threadAttacher.GetActivity()->clazz, jappOpenAdUnitId, jdefoldUserAgent, (jboolean)enableTestAds));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

annoying to add more params, but it may initialize App Open AD there, so we need to do it before that

Log.d(TAG, "Test ads enabled for this device: " + (deviceId != null ? deviceId : "unknown"));
}

private String getHashedDeviceId() {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we will be able to do so for ios, for android it is possible just to get ID of the device itself and make it test device - the only way to test mediation

sendSimpleMessage(MSG_INITIALIZATION, EVENT_COMPLETE);
}
});
new Thread(new Runnable() {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's recommended in the official manual to do it in a separate thread : https://developers.google.com/admob/android/mediation

}).start();
}

private void logAdapterStatus(InitializationStatus initializationStatus) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expected it to show useful information - such a naive guy ...

Comment thread updater/android.py
@@ -0,0 +1,322 @@
#!/usr/bin/env python3

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me these scripts is mediations support, there rest is just a bonus to make it easier to test it etc

@AGulev AGulev merged commit decf1a4 into master Jan 26, 2026
25 checks passed
@AGulev AGulev deleted the mediation branch January 26, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants