What’s the most straightforward way to remove some app permissions?
I noticed that on install my app asks for much more than it will ever use and I don’t want users to think that something shady is going on. I see the Extra Permissions section in the Android Settings, but I’m trying to remove permissions, not add them.
Good news, I got rid of all the permissions
In your projectfolder go to GAME\Main\Intermediate\Android\APK.
You can look at the AndroidManifest.XML, and see all of the permissions.
You can’t change this file by simply deleting all the permissions, but here is what you do:
Copy the important text in between
‘!–Requirements-- and
/manifest’, like androidSDKversion etc (only essential stuff, and the permissions you want).
Then, make a .txt file named ‘ManifestRequirementsOverride.txt’ in the GAME/Build/Android folder.
Every line you will put in this file, will overwrite your AndroidManifest.XML-lines between ‘!–Requirements-- and
/manifest’.
So if you leave this file blanc, all permissions will be gone, but you will have some other problems when building…
Thats why you need to keep in some of the sdk and feature stuff
Maybe you’ll need to adjust some things to make it work for your project, or put in some permissions that you do want to use. For example, I still put in the wake_lock, because it doesn’t even ask users for permission, and it’s a nice feature After building the game, your project’s AndroidManifest.XML will be updated, and will not need any permissions.
(2) In YourProject/Source/YourProject.Build.cs add:
var manifest_file = Path.Combine(ModuleDirectory, "AndroidSanitizePermissions_UPL.xml");
AdditionalPropertiesForReceipt.Add(
new ReceiptProperty("AndroidPlugin", manifest_file)
);
Now the unnecessary permissions will be removed from manifest.
I suppose the Source directory only exists for C++ projects. In order to try this method, you could start a C++ project or convert an BP-only project to a C++ one using existing tutorials.
(You should not need any C++ code though, just YourProject.Build.cs)
I found my self a solution for removing the permissions when you can’t use the ManifestRequirementsOverride.txt.
It is based on the post of MarcelBlanck (#3) but it works with the Launcher Version 4.14.3 and Blueprint projects.
You have to do this only once per Engine Version and after that you only have to add your needed permissions in the project settings. So no more ManifestRequirementsOverride.txt is needed anymore.
I will post a detailed instruction in february, but if you want to know it faster, you can text me.
So I tried this and it didn’t work. I tried using the override and while the permissions are fixed, the game doesnt launch!! (just crashes on android). Any suggestions?
I have encountered a similar problem when removing the network permission - my question.
They said it will crash if you remove that permission in “Launch from editor”, but should be fine to remove it when you are building an APK.