SDK configuration
Please follow the steps below to introduce the required configuration for integrating the SDK, skipping or omitting it will cause the integration to fail.
#
Permission configuration#
(1)CN Network SDK- If you're integrating the CN SDK, you need to add these extra permissions:
- CSJ SDK - necessary permissions
#
(2)Overseas Network SDK- Pangle SDK——necessary permissions
- Android 12 and above, agree to get Android Advertiser Identifier:
#
(3)Optional permissions- Apply for the following permissions for the anti-cheating function and help the advertising platform to serve ads
#
Manifest ProviderThe configuration statement is the compatibility processing performed by the third-party platform in order to make the advertisement display normally. The developer adds the corresponding <meta-data>
and <provider>
elements in the following positions according to the connected advertisement source.
#
(1)Google Admob- Add your AdMob app ID (identified in the AdMob UI) to your app's AndroidManifest.xml file. To do so, add a
<meta-data>
tag with android:name="com.google.android.gms.ads.APPLICATION_ID". You can find your app ID in the AdMob UI. For android:value, insert your own AdMob app ID, surrounded by quotation marks.
#
(2)Applovin- Add the SDK Key, add the following
<meta-data>
element to your AndroidManifest.xml, inside the<application>
element:
- TPV7.3.0.1 began to support the server to deliver the SDK KEY.
#
(3)SmaatoIf your application targets Android 5.0 (API level 21) or higher, then you need to add the following line to your application AndroidManifest.xml file:
#
(4)GDT- If the targetSdkVersion >= 24 when you package the App, in order to allow the SDK to download and install App-like advertisements normally. Need to add
provider
tag - The gdt_file_path.xml file Tencent side writes directly into the GDT SDK. If the resource package is not successfully imported, an error will be reported that the file cannot be found.
#
(5)Mintegral CN- 中国大陆流量版本必需,海外版本可以不添加
- 需要在AndroidManifest.xml中添加
provider
标签 - 其中
mb_provider_paths
文件TP直接写入MTG adapter中。如果没成功引入,会报错找不到该文件。 - xml找不到,开发者需自行检查,项目中是否正常引入MTG adapter。
#
(6)头条穿山甲CSJ- 需要在AndroidManifest.xml中添加
provider
标签 - 其中
file_paths .xml
文件TP直接写入toutiao adapter中。如果没成功引入,会报错找不到该文件。 - xml找不到,开发者需自行检查,项目中是否正常引入toutiao adapter。
#
(7)国内Sigmob- 其中
sigmob_provider_paths.xml
文件TP直接写入sigmob adapter中。如果没成功引入,会报错找不到该文件。 - xml找不到,开发者需自行检查,项目中是否正常引入sigmob adapter。
#
(8)国内米盟Mimo其中
file_paths.xml
文件TP直接写入mimo adapter中。如果没成功引入,会报错找不到该文件。xml找不到,开发者需自行检查,项目中是否正常引入mimo adapter。
AndroidX 项目需要添加
- Android Support 项目需要添加
#
Android 9以上适配注意:如果缺少该配置,可能会导致广告图片显示不出来
#
网络安全配置Google为保证用户数据和设备的安全,针对Android 系统(Android P) 的应用程序要求默认使用加密连接。在Android P系统的设备上,如果应用使用的是非加密的明文流量的http网络请求,则会导致该应用无法进行网络请求,https则不会受影响;故开发者需要更改 App 的网络安全配置以允许此类连接。
更多了解,请看Google官网文档网络安全配置。
- 添加网络安全配置文件:
- 其中在项目的res/xml文件夹新增network_security_config.xml,内容如下:
项目路径:res/xml/network_security_config.xml:
#
Apache的兼容在 Android 6.0 中,SDK移除了对 Apache HTTP 客户端的支持。从 Android 9 开始,该内容库已从 bootclasspath 中移除,且默认情况下应用无法使用它。
更多了解,请看Google官网文档 Apache HTTP 客户端弃用。
#
Android 12以上适配- 集成Admob、IronSource、Fyber上架Google Play市场的应用
- 其中Admob 移动广告 SDK 版本 20.4.0 或更高版本已经默认声明该权限
- 项目target更新到 31 (Android 12) ,则需要许可来读取设备的广告 ID。
- 了解更多请查看Google Advertising ID changes
- 集成Tapjoy V12.9.0 (TradPlus V7.7.0.1及以上),该SDK包括play-services-ads v17.1.0。对于Google Play Families Program成员,17.1.0版本 play-services-ads 中包括的AD_ID许可必须删除。
#
视频广告的硬件加速- 集成Meta(Facebook)、Mintegral、ChartBoost等视频广告需要启用硬件加速渲染,否则可能会在视频视图中遇到黑屏。
- 将以下属性添加到
<application>
标记以启用整个应用程序的硬件加速
#
混淆配置- 漏添加混淆文件,将导致打Release包时无法拉取到TP广告配置而请求广告失败。
#
资源优化广告SDK的资源不能被混淆,如果使用第三方的资源优化框架,请配置SDK的资源为白名单,例如: