Follow these steps to integrate and configure the Auto Update SDK in your Unity project.
Step 1 | Import the SDK
Import the Unity Auto Update SDK package file into your project.
Step 2 | Modify the Unity manifest file
First, make sure the AndroidManifest, mainTemplate, and gradleTemplate files can be updated. To do this, go to Edit > Project Settings > Publishing Settings and enable the following options:
- Custom Main Manifest: Makes the manifest file editable so you can add additional configurations.
- Custom Main Gradle Template: Makes the Gradle template editable for adding custom properties.
- Custom Gradle Properties Template: Allows you to manually build options and dependencies.
Once enabled, update your AndroidManifest file to include the necessary permissions, activity, and content provider:
- Include these permissions:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
- Add an activity to request installation permissions from the players:
<activity
android:name="com.appcharge.update.InstallPermissionHelperActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:exported="false" />
- Add the following provider tag in the
<application>
tag:
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/paths" />
</provider>