Skip to main content

How to update your AndroidManifest.xml

Update your Unity AndroidManifest.xml#

1.Permission configuration#

Set the following permissions in your project's AndroidManifest.xml:

<manifest>
<!--Must have permission-->
<!--YouDao(China)、Sigmob(China)-->
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<!-- Pangle: If there is a video ad and it is played with textureView, please be sure to add this, otherwise a black screen will appear -->
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<!-- Optional permissions -->
<!-- Smaato -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- Tapjoy、Pangle(China)、GDT(China)- -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<!--Vungle、Adcolony、Pangle(China)-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18"/>
<!--Mopub、GDT(China)、Pangle(China)-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<!--Adcolony -->
<uses-permission android:name="android.permission.VIBRATE"/>
<!--Pangle(China)、GDT(China)-->
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<!--Pangle(China)、GDT(China)-->
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
<!--Pangle(China)-->
<uses-permission android:name="android.permission.GET_TASKS"/>
</manifest>

2.Set Activity Definitions#

(1)If Mitegral China-Mainland is aggregated (Only Support AndroidX),the following configuration must be added to AndroidManifest.xml#

<!--Android X China-Mainland Traffic app required, Oversea Traffic app can be ignore-->
<provider
android:name="com.mbridge.msdk.foundation.tools.MBFileProvider"
android:authorities="${applicationId}.mbFileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/mb_provider_paths"/>
</provider>

That mb_provider_paths.xml has been written into the three-party aar resource package

(2)If Admob is aggregated, the following configuration must be added to AndroidManifest.xml (you can find your app ID in the AdMob UI).#

For details,update_your_androidmanifest

<application>
<!--Add your Google AdMob App ID-->
<!--Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713-->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~3347511713"/>
</application>

(3)If Applovin is aggregated, the following configuration must be added to AndroidManifest.xml (you can find your SDK Key in the AppLovin).#

For details,Where to get the AppId or SDK Key

<application>
<!--AppLovin -->
<!--Add your Applovin SDK Key-->
<meta-data
android:name="applovin.sdk.key"
android:value="YOUR_SDK_KEY_HERE" />
</application>

(4)If Tencent GDT is aggregated, the following configuration must be added to AndroidManifest.xml#

<provider
android:name="com.qq.e.comm.GDTFileProvider"
android:authorities="${applicationId}.gdt.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/gdt_file_path" />
</provider>

That gdt_file_path.xml has been written into the three-party aar resource package

(5)If Smaato is aggregated, 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:#

For details,Smaato integration

<uses-feature android:name="android.hardware.location.network" />

(6)If Kuaishou is aggregated, the following configuration must be added to AndroidManifest.xml#

<permission
android:name="${applicationId}.permission.KW_SDK_BROADCAST"
android:protectionLevel="signature" />
<uses-permission android:name="${applicationId}.permission.KW_SDK_BROADCAST" />

(7)If YouDao is aggregated, the following configuration must be added to AndroidManifest.xml#

<provider
android:name="com.youdao.sdk.extra.common.AdDownloadProvider"
android:authorities="${applicationId}.youdaosdk"
android:exported="false"
android:grantUriPermissions="true" >
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/ad_download_paths" />
</provider>

That ad_download_paths.xml has been written into the three-party aar resource package

(8)If Joomob is aggregated, the following configuration must be added to AndroidManifest.xml#

<provider
android:name="com.joomob.sdk.common.FileProvider"
android:authorities="${applicationId}.uniplay.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/uniplay_file_path" />
</provider>

That uniplay_file_path.xml has been written into the three-party aar resource package

3.Android 9 Adaptation#

Added the following configuration in AndroidManifest.xml:

<application>
<!--The configuration of usesCleartextTraffic must be set. The main function is to make http requests available in the game (must be used)-->
<manifest>
...
<application
android:usesCleartextTraffic="true">
<!--This setting is mainly to adapt to machines above 9.0 (must be used)-->
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
</manifest>
</application>