This repository has been archived by the owner on Mar 9, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 136
Manual Setup for Android
Süleyman Yasir KULA edited this page May 5, 2021
·
5 revisions
IMPORTANT: it is no longer necessary to apply these steps manually. In fact, doing so may result in build errors like "duplicate <provider> entries in AndroidManifest.xml" and etc.
- using a ContentProvider requires a small modification in AndroidManifest. If your project does not have an AndroidManifest.xml file located at Assets/Plugins/Android, you should copy Unity's default AndroidManifest.xml from C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer (it might be located in a subfolder, like 'Apk') to Assets/Plugins/Android (credit)
- inside the
<application>...</application>
tag of your AndroidManifest, insert the following code snippet:
<activity android:name=".NativeShareCustomShareDialogActivity" android:theme="@style/Theme.NativeShareTransparent" />
<provider
android:name="com.yasirkula.unity.NativeShareContentProvider"
android:authorities="MY_UNIQUE_AUTHORITY"
android:exported="false"
android:grantUriPermissions="true" />
Here, you should change MY_UNIQUE_AUTHORITY with a unique string. That is important because two apps with the same android:authorities string in their <provider>
tag can't be installed on the same device. Just make it something unique, like your bundle identifier, if you like. For example:
NOTE: if you are also using the NativeCamera plugin, make sure that each plugin's provider has a different android:authorities string.