MAS Knowledge Base

MAS Knowledge Base

Docy

SDK Integration

1. Initial configuration

Make sure multiDex is enabled in your build.gradle.

				
					defaultConfig {
    multiDexEnabled true
}
				
			

Add this content to gradle.properties file.

				
					android.useAndroidX=true
android.enableJetifier=true
android.enableDexingArtifactTransform=false
				
			

2. Add 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 android:value with your own Admob ID.
				
					<manifest>
	<application>
	<!-- Sample Admob ID: ca-app-pub-3940256099942544~3347511713 -->
	<meta-data
		android:name="com.google.android.gms.ads.APPLICATION_ID"
		android:value="YOUR_ADMOB_APP_ID"/>
	</application>
</manifest>
				
			

3. Comply with the legal frameworks

Custom privacy dialog

When you use your own privacy dialog :

  • If the user’s age >= 13, then set COPPA to false, otherwise set it to true.
  • If the user’s age >= 16 and consents to having his data collected, then set GDPR to true, otherwise set it to false.
  • If the user consents to having his data collected, then set CCPA to false, otherwise set it to true.

You’ll find the details about how to set the legal frameworks through these links:

MAS privacy dialog

You can enable the built-in privacy compliance dialog to collect the users’ age and consent. Here is a picture of the pop up:

1. Enable (Before the SDK initialization)

				
					Yodo1MasAdBuildConfig config = new Yodo1MasAdBuildConfig.Builder().enableUserPrivacyDialog(true).build();
Yodo1Mas.getInstance().setAdBuildConfig(config);
				
			
				
					val config = Yodo1MasAdBuildConfig.Builder().enableUserPrivacyDialog(true).build()
Yodo1Mas.getInstance().setAdBuildConfig(config)
				
			

2. Custom user agreement (optional)

				
					Yodo1MasAdBuildConfig config = new Yodo1MasAdBuildConfig.Builder().enableUserPrivacyDialog(true).userAgreementUrl("Your user agreement url").build();    
Yodo1Mas.getInstance().setAdBuildConfig(config);
				
			
				
					val config = Yodo1MasAdBuildConfig.Builder().enableUserPrivacyDialog(true).userAgreementUrl("Your user agreement url").build()   
Yodo1Mas.getInstance().setAdBuildConfig(config)
				
			

3. Custom privacy policy (optional)

				
					Yodo1MasAdBuildConfig config = new Yodo1MasAdBuildConfig.Builder().enableUserPrivacyDialog(true).privacyPolicyUrl("Your privacy policy url").build();    
Yodo1Mas.getInstance().setAdBuildConfig(config);
				
			
				
					val config = Yodo1MasAdBuildConfig.Builder().enableUserPrivacyDialog(true).privacyPolicyUrl("Your privacy policy url").build()
Yodo1Mas.getInstance().setAdBuildConfig(config)
				
			

4. Customize the appearance (optional)

The pop up is divided into 3 sections:

You can customize the background color of the 3 highlighted areas.

				
					Yodo1MasUserPrivacyConfig agePopBuildConfig = new
Yodo1MasUserPrivacyConfig.Builder()
.titleBackgroundColor(Color.BLUE)
.titleTextColor(Color.WHITE)
.contentBackgroundColor(Color.WHITE)
.contentTextColor(Color.BLACK)
.buttonBackgroundColor(Color.BLUE)
.buttonTextColor(Color.WHITE)
.build();
Yodo1MasAdBuildConfig config = new
Yodo1MasAdBuildConfig.Builder()
.enableUserPrivacyDialog(true)
.userPrivacyConfig(agePopBuildConfig)
.build();
Yodo1Mas.getInstance().setAdBuildConfig(config);
				
			
				
					val agePopBuildConfig =
Yodo1MasUserPrivacyConfig.Builder()
.titleBackgroundColor(Color.BLUE)
.titleTextColor(Color.WHITE)
.contentBackgroundColor(Color.WHITE)
.contentTextColor(Color.BLACK)
.buttonBackgroundColor(Color.BLUE)
.buttonTextColor(Color.WHITE)
.build()
val config = Yodo1MasAdBuildConfig.Builder()
.enableUserPrivacyDialog(true)
.userPrivacyConfig(agePopBuildConfig)
.build()
Yodo1Mas.getInstance().setAdBuildConfig(config)
				
			

5. Get user age (optional)

				
					int age = Yodo1Mas.getInstance().getUserAge();
				
			
				
					val age = Yodo1Mas.getInstance().getUserAge()
				
			

4. Initialize the SDK

Initialize the SDK by using the onCreate method of Activity.

				
					Yodo1Mas.getInstance().initMas(this, "YourAppKey", new Yodo1Mas.InitListener() {
    @Override
    public void onMasInitSuccessful() {
    }

    @Override
    public void onMasInitFailed(@NonNull Yodo1MasError error) {
    }
});
				
			
				
					Yodo1Mas.getInstance().initMas(this, "YourAppKey", object : Yodo1Mas.InitListener {
   override fun onMasInitSuccessful() {    
    Toast.makeText(this@MainActivity, "[Yodo1 Mas] Successful initialization", Toast.LENGTH_SHORT).show()
   } 
   override fun onMasInitFailed(error: Yodo1MasError) {
    Toast.makeText(this@MainActivity, error.message, Toast.LENGTH_SHORT).show()  
   }
})
				
			

5. Video tutorial

CONTENTS