Menu

Mainland China version access configuration

1. Integration instructions

1.The Taku AppID, Taku AppKey, and Taku PlacementID used in the document can all be obtained from the Taku background-traffic management (advertising space) page. Only the parameters obtained from the Taku background need to be used in the code. Advertisement All relevant parameters of the platform (AppID, AppKey, etc.) are configured in the Taku background.

2.Taku SDK loading reference process

3.Reference Demo Android Demo Github address (click to jump)

   Demo directory description:

Table of contentsDescription
ChinaDemo directory in Mainland China
NonChinaDemo of AAR/JAR integration outside mainland China
NonChina_JcenterGradle integration method Demo

The integration method in the Demo is for reference only. The description of each Activity is as follows:

ActivityDescription
RewardVideoAdActivityRewarded Video
InterstitialAdActivityInterstitial screen/interstitial video/full screen video
NativeAdActivityNative/Information Flow/Draw Ads
BannerAdActivity Banner ads
SplashAdActivity, SplashAdShowActivityOpen screen advertisement

2. Taku SDK import

Note: 1. The integration of this document does not support publishing to Google Play, otherwise the application will be removed. 2. Recommended Gradle Plugin version: 3.5.4+, Gradle version: 5.4.1+, click to view Gradle Plugin Correspondence with Gradle.

2.1 Integrate Mainland China SDK

(1) Enter Taku SDK's Packaging system, select the option for Mainland China, and check the third-party advertising platforms that need to be aggregated, as shown in the figure below:

In order to increase domestic monetization income, it is recommended to additionally access WeChat Open SDK and associate the App ID in the TopOn developer backend. Specific access guidelines>

After selecting Mainland China, check the third-party SDK platform that needs to be aggregated, and then click the button in the upper right corner[Integrate] to generate the SDK download link.

  • In addition, in order to increase income, it is recommended to connect to WeChat Open SDK at the same time and associate the App ID in the TopOn developer backend. Specific access guidelines>

    (2) Download the SDK compressed package and unzip itrelease_folder(xxxxxxxxx) There will be the following content in the folder:
Directory/FileDescription
libsAggregate the package directory that must be integrated by the third-party Network SDK (place the aar and jar inside libs directory of the development project)
build.gradleCode content that needs to be integrated by project gradle
AndroidManifest.xml The components and configuration information in AndroidManifest need to be added to the AndroidManifest of the development project (no configuration is required if the file does not exist)
proguard-android.txtConfusion configuration (no configuration required if the file does not exist)
resAggregate resources that must be imported by the third-party Network SDK (if there are, copy all the folders inside to the res directory of the project, if not, no need to import)
keep.xmlIf shrinkResources is turned on when packaging or some third-party resource optimization framework is connected (such as AndResProguard), the resources in this file must be added to the whitelist, Otherwise it will cause crashes or advertising exceptions
whitelists.txtIf some third-party resource optimization framework is connected (such as AndResProguard), the resources in this file must be added to the whitelist, Otherwise it will cause crashes or advertising exceptions
Note: For versions before v6.2.93, please refer to keep.xml

When there are many advertisements to be aggregated, libs folder and res folder may contain many files. It is recommended to Create two new file directories under the same level directory as libs, for example, create topon_libs and topon_res folders, will libs files in the compressed package are put into topon_libs, will res Put the file into topon_res, and then import it into gradle:

android {
    ....
    sourceSets {
        main {
            res.srcDirs += 'topon_res'
        }
    }
    ...
}

dependencies {
    api fileTree(include: ['*.jar','*.aar'], dir: 'topon_libs')
}

This processing facilitates subsequent SDK update processing and will not mix the SDK resource files with the project resource files. mixed together.

(3) Gradle must be supplemented with the introduction of the Support v7 plug-in, otherwise the integration will fail:

android {
    //CompileSdkVersion requires a minimum of 28
    compileSdkVersion 28
}

dependencies {
    api 'com.android.support:appcompat-v7:28.0.0'
    api 'com.android.support:localbroadcastmanager:28.0.0'    
}

(4) AggregationKuaishou, Mintegral needs to add this dependency:

dependencies {
     api 'com.android.support:design:28.0.0'
}

(5) Aggregation Mimeng (5.2.1 + ) ,  needs to add the following dependencies, and must be converted according to step (7) into Android X

dependencies {
     api 'androidx.recyclerview:recyclerview:1.2.1'
}

(6) If used in the developer's project is AndroidX, you can convert Support to AndroidX through the following method

gradle.propertiesThe new configuration is as follows:

android.enableJetifier=true
android.useAndroidX=true

Note: If the developer's project uses When Android pre style="text-align: start;">dependencies { api 'implementation 'androidx.legacy:legacy-support-v4:1.0.0' }

(7) For Android system

ItemsFunctionPurposeTiming
READ_PHONE_STATE[Optional] Read information such as mobile phone device identificationCarry out ad placement and ad monitoring, attribution, and anti-cheatingApply when you call an SDK function that requires this permission. For example, when you need to adjust the ad monetization strategy and data analysis services based on device information.
WRITE_EXTERNAL_STORAGE[Optional] Allow applications to write to external storageApplication download advertising delivery and creative storageApply when you call an SDK function that requires this permission. For example, when you place ads on other ad platforms, they apply when other ad platforms run ads.
READ_EXTERNAL_STORAGE[Optional] Allow the application to read external storageApplication download advertising delivery and creative storageApply when you call an SDK function that requires this permission. For example, when you place ads on other ad platforms, they apply when other ad platforms run ads.
INTERNET[Optional] Mobile networkFor online advertising service requestsApply when you call an SDK function that requires this permission. For example, when you need to adjust the ad monetization strategy and data analysis services according to the mobile network situation.
REQUEST_INSTALL_PACKAGES[Optional] Perform application installation operationsApp installs for ad servingApply when you call an SDK function that requires this permission. For example, when you place ads on other ad platforms, the other ad platforms need to apply for ad placement based on the application software list.
ACCESS_WIFI_STATE[Optional] Monitor WIFI network changesFor online ad serving policy updatesApply when you call an SDK function that requires this permission. For example, when you need to adjust the ad monetization strategy and data analysis services according to the changes in the WIFI network.
ACCESS_NETWORK_STATE[Optional] Listen for network changesFor online ad serving policy updatesApply when you call an SDK function that requires this permission. For example, when you need to adjust the ad monetization strategy and data analysis services according to the changes in the mobile network.

2.2 Integrated OAID

Because Android 10 cannot obtain the IMEI, it may affect the ad filling of some advertising platforms. It is recommended that you access it OAID SDK to get OAID。Click to view detailed integration steps

3. Permission description

1. The permissions required by Taku SDK are as follows:

2. It is recommended to obtain READ_PHONE_STATEPermissions

Note: For the permissions required by the advertising platform, AndroidManifest.xml in the downloaded SDK compressed package must be Configure content to your project

4. ABI architecture

The SDKs of some advertising platforms include the so library. The architecture supported by the so files used by each platform is as follows: (Developer Select the following architecture as needed)

Pangolin: arm64-v8a, armeabi-v7a

Kuaishou Advertisement: arm64-v8a, armeabi-v7a, armeabi, x86_64, x86

Recommendation:Add the following configuration in build.gradle to basically support most mobile phone architectures:

defaultConfig {
    ...
    ndk{
        abiFilters 'armeabi-v7a','x86'
    }
}

5. SDK obfuscation configuration instructions

5.1 Proguard configuration

Note: The following is the obfuscation configuration of Taku SDK and the obfuscation configuration of the advertising platform You must refer to the proguard-android.txt file

-keep public class com.anythink.**
-keepclassmembers class com.anythink.** {
   *;
}

-keep public class com.anythink.network.**
-keepclassmembers class com.anythink.network.** {
   public *;
}

-dontwarn com.anythink.hb.**
-keep class com.anythink.hb.**{ *;}

-dontwarn com.anythink.china.api.**
-keep class com.anythink.china.api.**{ *;}

-keep class com.anythink.myoffer.ui.**{ *;}
-keepclassmembers public class com.anythink.myoffer.ui.** {
   public *;
}

5.2 Resource Optimization

If you enable shrinkResource, you need to add a keep.xml under the res/raw path, and then the content is the content of the keep.xml file of the SDK compressed package. The example is as follows (Click to view Android resource optimization processing):

If some third-party resource optimization frameworks (such as AndResProguard) are introduced, all files ending with anythink is the prefix of resourcesAdd to whitelist, for example:

R.string.anythink_*
R.drawable.anythink_*
R.layout.anythink_*
R.id.anythink_*
R.dimen.anythink_*
R.style.anythink_*
R.color.anythink_*
R.anim.anythink_*

6. Adaptation for Android 9 and above

6.1 Apache compatible

  • Note: If the following configuration is missing, the ad image may not be displayed or there may be no callback for ad loading

(1) Add the following configuration to AndroidManifest:

<application>
    ...
    <uses-library android:name="org.apache.http.legacy" android:required="false"/>
    ...
</application>

(2) Compatible with some third-party advertising SDKs that have HTTP requests

Add in the application tag of AndroidManifest of Application Module: android :networkSecurityConfig configuration:

<application
    ...
    android:networkSecurityConfig="@xml/network_security_config"
    ...
    >
    ...
</application>

Add network_security_config.xml in the res/xml folder of the project, with the following content:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true" />
</network-security-config>

Note: If there are the following configurations in network_security_config.xml, it may cause adaptation failure

 
   
<domain-config cleartextTrafficPermitted="true"> 
    <domain includeSubdomains="true">xxxxxx</domain> 
</domain-config> 
 
 

6.2 Multi-process WebView compatible

(1) At the beginning in Application#onCreate() The location of (must be set before initializing other third-party SDKs)Add the code for Webview settings:

public class * extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        //Android 9 and above must be set up
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
            String processName = getProcessName();
            if (!getPackageName().equals(processName)) {
                WebView.setDataDirectorySuffix(processName);
            }
        }

        ...
    }
}

(2) Google documentation explains as follows:

If your app must use WebView in multiple processes instance, you must first use the WebView.setDataDirectorySuffix() method for each process Specify a unique data directory suffix before using the given instance of WebView in the corresponding process. This method places each process's network data into its own directory within the application data directory.

Before any WebView instance in the process is created, and called in this processWebView. setDataDirectorySuffix()Set the data directory of the process.

7. Ad test instructions

Previous
SDK access configuration
Next
Initialization
Last modified: 2025-05-30Powered by