Android SDK Guide(SPLASH)
The current version is 3.0.0.
Ad type
division | Sample | Explanation |
---|---|---|
Splash banner | This is a banner that appears on the splash screen when the app is launched. Banner is provided as a transparent PNG. Banner position/exposure time/exposure method (motion) is controlled by the medium. - Bottom position/exposure longer than 3 seconds recommended - Horizontal or vertical When adjusting the size, maintain the ratio and reduce the size - Be careful not to cover or cut the banner. - Available only in SDK version 3.0.0 or higher |
Supported product (size)
Product classification | size |
---|---|
Splash banner | 1200x1000 |
SDK library applied
Environment settings required for Android development are omitted from the paper.
Create Android Project to be developed.
Create a libs folder and add the provided manlibray.jar.
AndroidManifest.xml
android.permission is the permission setting required for ad insertion of the Ad SDK.
You must insert android:configChanges=”orientation|keyboard” in the attribute of the activity where you want to insert ads.
(To prevent waste of network resources due to continuous OnCreate calls)
From android9 (API 28), a value (android:usesCleartextTraffic=”true”) is inserted into the application due to the strengthened network security policy.
Advertisement image url load, tracking element, resource can be composed of http, so insert the appropriate option.
If the app to which the Ad SDK applies targets android11 (API Level 30) or higher, and you need to interact with an app other than the automatically displayed app, you need to add an element to the app’s manifest file.
Since our ad SDK uses Google Chrome by default when clicking an ad, a manifest file must be created as shown in the example below.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mezzomedia.sampleapp"
android:versionCode="1"
android:versionName="1.0" >
<!--Network usage -->
<!-- Permission: NetworkInterface Purpose: IP Address -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Permission: ConnectivityManager Purpose: Determine whether the communication connection is Mobile or Wifi. -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Use terminal information (MNC, MCC of the network operator in TelephonyManager) -->
<!-- Permission: Telephony DataNetworkType Type SDK version 24 or higher Purpose: Mobile network: 2G, 3G, LET, 5G, etc. -->
<uses-permission android:name="android.permission.READ_BASIC_PHONE_STATE" />
<!-- Permission: Telephony Network Type SDK version 23 and below Purpose: Mobile network: 2G, 3G, LET, 5G, etc. -->
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<!-- Permissions: Advertising ID-->
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
<application
android:usesCleartextTraffic="true"
android:name=".MZApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<!--SPLASH activity-->
<activity
android:exported="true"
android:name="com.mmc.adman.app.Splash"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize">
</activity>
</application>
</manifest>
Java source
SPLASH
SPLASH Activity used code.
private AdManView splashAd = null;
public void destroySplashAd() {
if (splashAd != null) {
splashAd.onDestroy();
splashAd = null;
}
}
//Sample source Navimanager.java
public void requestInlayoutInter(final Context c, final int p, final int m, final int s, final RelativeLayout bannerArea) {
AdData adData = new AdData();//Data organization class in ad settings
String appName = "appname";
//Required ad settings
adData.major("splashArea_ID", AdConfig.API_INTER, p, m, s, "http://www.storeurl.com", "packagename", appName, 320, 480);
//User age level required
adData.setUserAgeLevel(0);
//Whether to use permission
adData.isPermission(AdConfig.NOT_USED);
//Method used to add an interstitial ad to a specific layout
adData.setIsInLayout(AdConfig.USED);
splashAd = new AdManView(c);
splashAd.setData(adData, new AdListener() {
//Ad call success
@Override
public void onAdSuccessCode(Object v, String id, final String type, final String status, final String jsonDataString) {
((Activity) c).runOnUiThread(new Runnable() {
@Override
public void run() {
((Activity) c).runOnUiThread(new Runnable() {
@Override
public void run() {
if (AdResponseCode.Status.SUCCESS.equals(status)) {
inlayoutInter.addBannerView(bannerArea);
}
}
});
}
});
}
//Ad call failure error
@Override
public void onAdFailCode(Object v, String id, String type, String status, String jsonDataString) {
}
//Advertisement call failure error (webview error)
@Override
public void onAdErrorCode(Object v, String id, String type, String status, String failingUrl) {
}
//Events triggered by ads
@Override
public void onAdEvent(Object v, String id, String type, String status, String jsonDataString) {
if(AdEvent.Type.CLICK.equals(type)){
destroySplashAd();
}else if(AdEvent.Type.CLOSE.equals(type)){
destroySplashAd();
}
}
// Ad permission (location) setting request event-This is an event to receive app permission on the user terminal setting page.
@Override
public void onPermissionSetting(Object v, String id) {
// If the isPermission value is set to unused, no event occurs.
}
});
//Request method
inlayoutInter.request(new Handler());
}
Common
Method - This method is used when linking advertisements.
method | Explanation |
---|---|
AdManView ( Context context ) | Ad Creator (Used except for front pop-ups.) |
setData ( AdData adData, AdListener adListener ) | Ad setting method |
request( Handler handler ) | Start advertising logic |
onDestroy( ) | End of advertising logic |
addBannerView(ViewGroup bannerArea) | Method of placing advertisement in a specific area |
AdData - This is the data used to insert ads.
method | Explanation | Usable range |
---|---|---|
major(String id, String apiMode, int publisher, int media, int section, String storeUrl, String appId, String appName, int adAreaWidth, int adAreaHeight ) |
Required value setting method | common |
setUserAgeLevel(int userAgeLevel) | required Value User’s Age Level | common |
minor(String userGender, String userAge, String account, String userEmail) |
Option value setting method | common |
isPermission(String isReadPhone) | Whether to use permission (AdConfig.NOT_USED, AdConfig.USED) |
common |
setIsInLayout(String isInLayout) | Whether to use insert specific layout (AdConfig.NOT_USED, AdConfig.USED) |
Front |
setBackgroundColor(String color) | popup background color (default : #88000000) |
Front |
setDefaultBackgroundColor(String color) | ad background color (default : #000000) |
common |
major - Required value setting method
Factor value | Explanation |
---|---|
String id | Unique ID of the ad area to be used by the media ex) bannerid, interbannerid |
String apiMode | Ad type |
int publisher | Publisher code |
int media | Media code |
int section | Section code |
String storeUrl | Store url |
String appId | Package name |
String appName | App name |
int adAreaWidth | The size of the advertising area to be exposed |
int adAreaHeight | Ad area size height exposed |
ageLevel - user’s age level
constant | Explanation |
---|---|
0 | Child (under 13 years old) |
1 | Youth, Adult (13 years old or older) |
-1 | unknown |
AdConfig - This is the value used for ad settings.
constant | Explanation |
---|---|
AdConfig.SDK_VERSION | sdk version |
AdConfig.SDK_RELEASEDATE | sdk release date |
AdConfig.API_INTER | apiModeValue passed to: Front banner |
AdConfig.USED | isPermission, setIsInLayout, setIsCloseShow, setPopup Value set in the use of method such as |
AdConfig.NOT_USED | isPermission, setIsInLayout, setIsCloseShow, setPopup Value set in the use of method such as |
How to use AdListener
//Ad call success
@Override
public void onAdSuccessCode(Object v, String id, final String type, final String status, final String jsonDataString) {
if(AdResponseCode.Type.HOUSE.equals(type)){
//Ad Success: Free
}else{
//Advertising success: paid
}
}
//Ad call failure error
@Override
public void onAdFailCode(Object v, String id, String type, String status, String jsonDataString) {
if(AdResponseCode.Status.NOAD.equals(status)){
//Advertisement
}else if(AdResponseCode.Status.TIMEOUT.equals(status)){
//Network timeout
}else if(AdResponseCode.Status.ERROR_PARSING.equals(status)){
//Parsing error
}else if(AdResponseCode.Status.DUPLICATIONCALL.equals(status)){
//Duplicate call
}else if(AdResponseCode.Status.ERROR.equals(status)){
//Exceptional error
}else if(AdResponseCode.Status.ERROR_NOTSUPPORT_BROWSER.equals(status)){
//Not supported Browser
}else if(AdResponseCode.Status.ERROR_NOTSUPPORT_IOS.equals(status)){
//Not supported Ios version
}else if(AdResponseCode.Status.ERROR_NOTSUPPORT_ANDROID.equals(status)){
//Not supported Android version
}else if(AdResponseCode.Status.NEEDSYNC.equals(status)){
//ajax error
}else if(AdResponseCode.Status.DEVICE_NETWORK_ERROR.equals(status)){
//Terminal network status error
}else if(AdResponseCode.Status.DEVICE_RENDERING_TIMEOUT.equals(status)){
//Ad rendering timeout
}else if(AdResponseCode.Status.DEVICE_SETTING_ERROR.equals(status)){
//Ad data incorrect setting error
}else if(AdResponseCode.Status.DEVICE_AD_INTERVAL.equals(status)){
//Call error within the set time after ad call
}else if(AdResponseCode.Status.APP_LIFECYCLE_BACK.equals(status)){
//Errors that occur when calling the background
}
}
//Advertisement call failure error (webview error)
@Override
public void onAdErrorCode(Object v, String id, String type, String status, String failingUrl) {
int errorCode = Integer.valueOf(type);
switch (errorCode) {
case WebViewClient.ERROR_AUTHENTICATION:
//User authentication failure on server
break;
case WebViewClient.ERROR_BAD_URL:
//Invalid URL
break;
case WebViewClient.ERROR_CONNECT:
//Failed to connect to server
break;
case WebViewClient.ERROR_FAILED_SSL_HANDSHAKE:
//Failure to perform SSL handshake
break;
case WebViewClient.ERROR_FILE:
//Generic file error
break;
case WebViewClient.ERROR_FILE_NOT_FOUND:
//File not found
break;
case WebViewClient.ERROR_HOST_LOOKUP:
//Server or proxy host name lookup failure
break;
case WebViewClient.ERROR_IO:
//Failure to read from or write to server
break;
case WebViewClient.ERROR_PROXY_AUTHENTICATION:
//User authentication failure at proxy
break;
case WebViewClient.ERROR_REDIRECT_LOOP:
//Too many redirects
break;
case WebViewClient.ERROR_TIMEOUT:
//Connection timeout
break;
case WebViewClient.ERROR_TOO_MANY_REQUESTS:
//Too many requests during page loading
break;
case WebViewClient.ERROR_UNKNOWN:
//General error
break;
case WebViewClient.ERROR_UNSUPPORTED_AUTH_SCHEME:
//Authentication scheme not supported
break;
case WebViewClient.ERROR_UNSUPPORTED_SCHEME:
//How the URI is not supported
break;
}
}
//Events triggered by ads
@Override
public void onAdEvent(Object v, String id, String type, String status, String jsonDataString) {
if(AdEvent.Type.IMP.equals(type)){
//Ad imps Event
}
}
AdListener Explanation
method | Explanation |
---|---|
onAdSuccessCode(Object v, String id, String type, String status, String jsonDataString) | Ad success event |
onAdFailCode(Object v, String id, String type, String status, String jsonDataString) | Event that occurs when an error occurs |
onAdErrorCode(Object v, String id, String type, String status, String failingUrl) | Web view area event where advertisement is displayed ( WebViewClient Reference ) |
onAdEvent(Object v, String id, String type, String status, String jsonDataString) | Events happening in advertising |
Success type Code
Type | Explanation |
---|---|
AdResponseCode.Type.HOUSE | Free advertising |
AdResponseCode.Type.GUARANTEE | Paid advertising |
onAdFailCode status Code
Status | Explanation |
---|---|
AdResponseCode.Status.SUCCESS | success |
AdResponseCode.Status.NOAD | Ads for that ID do not exist |
AdResponseCode.Status.NEEDSYNC | ajax error |
AdResponseCode.Status.TIMEOUT | timeout |
AdResponseCode.Status.ERROR_PARSING | parsing error |
AdResponseCode.Status.DUPLICATIONCALL | duplicate call |
AdResponseCode.Status.ERROR | Exceptional error |
AdResponseCode.Status.ERROR_NOTSUPPORT_BROWSER | Unsupported browser |
AdResponseCode.Status.ERROR_NOTSUPPORT_IOS | Unsupported iOS version |
AdResponseCode.Status.ERROR_NOTSUPPORT_ANDROID | Unsupported Android version |
AdResponseCode.Status.DEVICE_NETWORK_ERROR | network error |
AdResponseCode.Status.DEVICE_RENDERING_TIMEOUT | Ad rendering timeout |
AdResponseCode.Status.DEVICE_SETTING_ERROR | Ad data incorrect setting error |
AdResponseCode.Status.DEVICE_AD_INTERVAL | Call error within the set time after ad call |
AdResponseCode.Status.APP_LIFECYCLE_BACK | Errors that occur when calling the background |
onAdEvent type Code
Status | Explanation |
---|---|
AdEvent.Type.IMP | Ad imps Event |
Q&A
check whether an ad is exposed successfully
No | Description |
---|---|
1 | Q. If there are no ads or free ads after the set of commercial advertisement A. The error of advertising exposure after you set up an ad is largely due to the incorrect code or to the test code. Please check the setting. If you are unable to see the commercial advertisement continuously, Please contact us. |
handling No ad (passback)
No | Description |
---|---|
1 | Q. No ad handling questions A. If the ad assigned to that ID does not exist or runs out of stock, or depending on time, application type, category, and date, the number of ads that can also be exposed may vary After a certain period of time, you can request an advertisement again or proceed to the next progressive logic in the part where you received the callback. |
2 | Q. Why do I see the figures in the report even in the No ad situation? A. Even under No ad, the report number is normal, which is the call number for inventory check, not for actual exposure. |
Contact
Division | Team | Name | Contact | |
---|---|---|---|---|
affiliated inquiry | Mobile AD Sales Team | JeongHyeok Kim | jeonghyeok.kim@cj.net | +82) 2-6484-3856 |
ID issue and ad setting | Mobile AD Sales Team | SunMin Lee | sunmin.lee1@cj.net | +82) 2-6484-3461 |