Remove Permissions from your Manifest
Updated: Dec 17, 2024
Determining Permissions Used By Your App
There are many ways to see the permissions requested by your APK. Some are:
- Use the
aapt.exe
program that comes with Android SDK build tools. For instance, the following command outputs all permissions requested by MyAPK.apk
:
aapt.exe dump permissions C:\path\to\MyAPK.apk
- In Android Studio, select
File > Profile or Debug APK
, and open your desired APK. In the directory tree of your loaded APK, examine AndroidManifest.xml
for uses-permission
tags. - Upload your APK to the Meta Quest Developer Dashboard, then examine the list of permissions in Distribution > Builds, under the Details tab.
Removing Unwanted Manifest Permissions
Unity will automatically add permissions to the manifest to support relevant systems in your codebase. For example, if your app contains code that polls the microphone, Unity will automatically add the RECORD_AUDIO
permission to your manifest -- even if that code doesn’t actually get called at runtime.
To remove these permissions from your manifest, find and remove all code that references related functionality from your codebase.
Option B: Manifest Override If you can’t find the code responsible, you can request the fields be removed by using an AndroidManifest.xml override.
Add a node="remove"
attribute to each permission you wish to remove.
For example:
<uses-permission android:name="android.permission.WAKE_LOCK" tools:node="remove" />
Verify that the manifest contains the tools
namespace:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.yourpackage" xmlns:tools="http://schemas.android.com/tools">
Option A: Manifest override file Unreal Engine can use a manifest override file to remove unwanted permissions:
- Go to the Build\Android folder, and then create a new ManifestRequirementsOverride.txt file containing:
<uses-sdk android: USES_SDKS />
<uses-feature android: USES_FEATURES />
<uses-permission android:name="PERMISSION_NAME"/>
- Replace USES_SDKS and USES_FEATURES with the attributes as defined in the Main\Intermediate\Android\APK\AndroidManifest.xml file generated by Unreal Engine. You can copy them directly from that file.
- Replace PERMISSION_NAME with the name of the unwanted Android permission. You can exclude more than one permission by repeating the
<uses-permission>
element for each unwanted permission.
Example manifestRequirementsOverride.txt
<uses-sdk android:minSdkVersion="21"/>
<uses-feature android:glEsVersion="0x00030001" android:required="true" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
Option B: Unreal plugin language (C++ only)