Android Integration
1. Import Yodo1Ads.ts
Download Yodo1Ads.ts file and add it to your project, then create a new Node and drop Yodo1Ads.ts script on it.

2. Configure MAS
Add this line first in the script where you’ll implement MAS.
import Yodo1Ads from "./Yodo1Ads";
2.1/ Initialize the SDK
To Initialize MAS, you need to call the following code.
Yodo1Ads.getInstance().initializeMasSdk("YourAppkey",true);
Parameter #1 : Appkey, you can find it in MAS dashboard when you add your game.
Parameter #2 : PrivacyDialog, you need to set it to true to show our built-in privacy dialog, otherwise to false.

2.2/ Legal frameworks
If you don’t want to use our privacy dialog, you have to set the legal frameworks manually, make sure to set them before you initialize the SDK.
COPPA
If the user is above 13, set COPPA to false, otherwise to true.
Yodo1Ads.getInstance().setCOPPA(false);
GDPR
If the user is above 16 and gives consent then set GDPR to true, otherwise to false.
Yodo1Ads.getInstance().setGDPR(true);
CCPA
If the user gives consent, then set CCPA to false, otherwise to true.
Yodo1Ads.getInstance().setCCPA(false);
3. Interstitial Ads
Initialize the interstitials first using the following code.
Yodo1Ads.getInstance().initializeInterstitialAds();
Then you can show them with this code.
Yodo1Ads.getInstance().showInterstitialAds();
For the ad events, you can use the methods available in Yodo1Ads.ts.
public onInterstitialAdLoaded() {
}
public onInterstitialAdFailedToLoad() {
}
public onInterstitialAdOpened() {
}
public onInterstitialAdFailedToOpen() {
}
public onInterstitialAdClosed() {
}
4. Reward Ads
Initialize the ads first using the following code.
Yodo1Ads.getInstance().initializeRewardAds();
Then use the following code to show them.
Yodo1Ads.getInstance().showRewardAds();
For the ad events, you can use the methods available in Yodo1Ads.ts.
You can reward the player inside onRewardAdEarned().
public onRewardAdLoaded() {
}
public onRewardAdFailedToLoad() {
}
public onRewardAdOpened() {
}
public onRewardAdFailedToOpen() {
}
public onRewardAdClosed() {
}
public onRewardAdEarned() {
// Reward the user here
}
5. Banner Ads
5.1/ Load the banners
The following code will both load and show the banner.
Yodo1Ads.getInstance().loadBannerAds("Banner","RIGHT","TOP");
Parameter #1: BannerSize, you can choose any size from the following table.
Size in dp | Description | Availability | AdSize Constant |
---|---|---|---|
320×50 | Banner | Phones and Tablets | Banner |
320×100 | Large Banner | Phones and Tablets | LargeBanner |
300×250 | IAB Medium Rectangle | Phones and Tablets | IABMediumRectangle |
Full-screen width x Adaptive height | Adaptive Banner | Phones and Tablets | AdaptiveBanner |
Note: if you wish to choose any other size than the standard banner, please contact us so we can configure it for your game.
Parameter #2 and #3: These are the horizontal and vertical alignments for the banner respectively.
5.2/ Hide and show the banner
The following code will hide and show the banners.
Yodo1Ads.getInstance().hideBannerAds();
Yodo1Ads.getInstance().showBannerAds();
5.3/ Banner events
Use these methods in Yodo1Ads.ts if you want to use the banner events.
public onBannerAdLoaded() {
}
public onBannerAdFailedToLoad() {
}
public onBannerAdOpened() {
}
public onBannerAdFailedToOpen() {
}
public onBannerAdClosed() {
}
6. Build the Android Project
Go to Project > Build and click on the Build button.

Then open the generated folder in Android Studio: your_project_folder/build/jsb-default/frameworks/runtime-src/proj.android-studio
7.Gradle Setup
Once the project is opened in Android Studio, follow the next steps.
7.1/ Add the repositories to build.gradle project level
Standard SDK
If your game is not enrolled in Designed for Families program.
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://artifact.bytedance.com/repository/pangle' }
maven { url 'https://android-sdk.is.com' }
maven { url "https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea" }
}
}
Family SDK
If your game is enrolled in Designed for Families program.
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://android-sdk.is.com' }
}
}
7.2/ Add the MAS dependency in build.gradle app level
Standard SDK
implementation 'com.yodo1.mas:full:4.8.5'
Family SDK
implementation 'com.yodo1.mas:google:4.8.5'
7.3/ Add Multidex in the defaultConfig section in build.gradle app level
multiDexEnabled true
7.4/ Add the following lines in gradle.properties
android.useAndroidX=true
android.enableJetifier=true
android.enableDexingArtifactTransform=false
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2560m
And set PROP_MIN_SDK_VERSION to 21.
7.5/ Add our proguard content from this link in your proguard file.
8. Set up the Java code
8.1/ Add your Admob ID
- Add your
AdMob ID
to your app’s AndroidManifest.xml file. - Your Admob ID can be found under the “details” of your app on MAS Dashboard.
- Please replace
YOUR_ADMOB_ID
with your own Admob ID.
8.2/ Add Yodo1Ads.java file in the same directory as AppActivity.java

8.3/ In AppActivity.java, add the following code.
public static void initializeSdk(String appKey,boolean isEnabled)
{
Yodo1Ads.initializeSdk(activity, appKey,isEnabled);
}
public static void loadBannerAds(String size,String horizontal,String Vertical){
Yodo1Ads.loadBannerAds(size,horizontal,Vertical);
}
public static void hideBannerAds(){
Yodo1Ads.hideBannerAds();
}
public static void showBannerAds(){
Yodo1Ads.showBannerAds();
}
public static void initializeInterstitialAds()
{
Yodo1Ads.initializeInterstitialAds();
}
public static void showInterstitialAds()
{
Yodo1Ads.showInterstitialAds();
}
public static void initializeRewardAds()
{
Yodo1Ads.initializeRewardAds();
}
public static void showRewardAds()
{
Yodo1Ads.showRewardAds();
}
public static void setCOPPA(boolean isEnabled)
{
Yodo1Ads.setCOPPA(isEnabled);
}
public static void setGDPR(boolean isEnabled)
{
Yodo1Ads.setGDPR(isEnabled);
}
public static void setCCPA(boolean isEnabled) {
Yodo1Ads.setCCPA(isEnabled);
}
8.4/ Create an AppActivity static object in AppActivty.java and make sure to set AppActivity to the current instance.

9. Test
Now you can build the apk and test your integration.
10. Set up the app-ads.txt
Click here for more details.