-
-
Notifications
You must be signed in to change notification settings - Fork 71
Manual Setup for Android
Süleyman Yasir KULA edited this page May 5, 2021
·
3 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.
- set Write Permission to External (SDCard) in Player Settings
- NativeCamera 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:
<provider
android:name="com.yasirkula.unity.NativeCameraContentProvider"
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:
- (optional) inside the
<manifest>...</manifest>
tag of your AndroidManifest, insert<uses-feature android:name="android.hardware.camera" android:required="false" />
to declare that your app benefits from camera (if your app requires a camera/can't run without one, then change the value of android:required to true)
NOTE: if you are also using the NativeShare plugin, make sure that each plugin's provider has a different android:authorities string.