x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Removing Android app permissions.

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.

Thanks ahead of time.

Product Version: UE 4.9
Tags:
more ▼

asked Oct 16 '15 at 02:14 AM in Packaging & Deployment

dimzorz gravatar image

dimzorz
94 4 17 15

dimzorz gravatar image dimzorz Oct 28 '15 at 03:29 PM

Anyone?___

JGI-Roel gravatar image JGI-Roel Jan 27 '16 at 01:50 PM

Same problem here...

Ivan1208 gravatar image Ivan1208 Feb 02 '16 at 11:15 PM

And here...

(comments are locked)
10|2000 characters needed characters left

3 answers: sort voted first

Hey guys,

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:

  1. Copy the important text in between '!--Requirements-- and /manifest', like androidSDKversion etc (only essential stuff, and the permissions you want).

  2. Then, make a .txt file named 'ManifestRequirementsOverride.txt' in the GAME/Build/Android folder.

  3. 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.

Hope this helps! :)

more ▼

answered Feb 03 '16 at 07:39 AM

JGI-Roel gravatar image

JGI-Roel
91 2 68 13

JGI-Roel gravatar image JGI-Roel Feb 03 '16 at 07:51 AM
 This is all i put in my ManifestRequirementsOverride.txt:
 
 <uses-sdk android:minSdkVersion="9"/>
 <uses-feature android:glEsVersion="0x00020000" android:required="true" />
 <uses-permission android:name="android.permission.WAKE_LOCK"/>
Ivan1208 gravatar image Ivan1208 Feb 03 '16 at 10:42 AM

Great thanks! It's really work!

dimzorz gravatar image dimzorz Mar 02 '16 at 06:29 PM

Awesome! Thanks a lot, now people won't think that some random guy making games in his spare time is trying to harvest metadata

Crowsfield gravatar image Crowsfield Dec 19 '16 at 07:53 PM

Very usefull, thx. but in my case it does not remove Read_Phone_Stat and Get_Account. Do you you maybe know why?

Adynathos gravatar image Adynathos Dec 21 '16 at 10:47 PM

Have you tried my method using UPL? In my project it successfully removed READ_PHONE_STATE and GET_ACCOUNTS.

BostEST57 gravatar image BostEST57 Apr 26 '17 at 06:51 AM

For anyone still struggling with this, I couldn't get ManifestRequirementsOverride.txt working b/c I accidentally named it ManifestRequirementsOverride.txt.txt (the file extension was hidden)

Make sure it is only ManifestRequirementsOverride.txt

w0lfi gravatar image w0lfi Dec 28 '16 at 07:04 PM

I tried it and it doesn't work for me... The Manifest file uses the same permissions as before.

When i look in the Output Log I see this:

UATHelper: Packaging (Android (ETC1)): [proguard] Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])

I don't know what I should do with that information, but it says it can't write the Manifest.... Does anybody know something?

Thanks in advance!

(comments are locked)
10|2000 characters needed characters left

There is an elegant solution using the UPL mechanism, which allows you to modify android manifest and Activity class.

(1) Create a file YourProject/Source/YourProject/AndroidSanitizePermissions_UPL.xml with content:

 <?xml version="1.0" encoding="utf-8"?>
 <root xmlns:android="http://schemas.android.com/apk/res/android">
     <androidManifestUpdates>
         <removePermission android:name="android.permission.ACCESS_NETWORK_STATE" />
         <removePermission android:name="android.permission.ACCESS_WIFI_STATE" />
         <removePermission android:name="android.permission.READ_PHONE_STATE" />
         <removePermission android:name="com.android.vending.CHECK_LICENSE" />
         <removePermission android:name="android.permission.GET_ACCOUNTS" />
     </androidManifestUpdates>
 </root>

(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.

more ▼

answered Dec 12 '16 at 02:45 AM

Adynathos gravatar image

Adynathos
186 3 6 12

w0lfi gravatar image w0lfi Dec 28 '16 at 07:10 PM

I wanted to try your solution to this problem but i don't know where to place the files, because i can't find these 2 path's in my project folders...

YourProject/Source/YourProject/AndroidSanitizePermissions_UPL.xml YourProject/Source/YourProject.Build.cs

I have no "Source" - folder or anything similar there... Could you please help me with this?

Thanks in advance!

Adynathos gravatar image Adynathos Dec 28 '16 at 11:53 PM

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)

w0lfi gravatar image w0lfi Dec 29 '16 at 12:32 AM

Thank you for that fast reply. :) I`ll give it a try the next days.

Ohh and btw. your link about the UPL mechanism is broken.

RVillani gravatar image RVillani Feb 17 '17 at 08:18 AM

The link is not broken. You just need to have a GitHub account and associate it with your Unreal one. Steps are here.

(comments are locked)
10|2000 characters needed characters left

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.

more ▼

answered Jan 13 '17 at 09:57 AM

w0lfi gravatar image

w0lfi
6 1 3

ronaldk gravatar image ronaldk Feb 17 '17 at 04:35 PM

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?

Adynathos gravatar image Adynathos Feb 17 '17 at 04:43 PM

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.

TalkingIsGreat gravatar image TalkingIsGreat Feb 24 '17 at 09:28 AM

I'd like a detailed instruction. I can't get ManifestRequirementsOverride.txt to work anymore.

w0lfi gravatar image w0lfi Mar 04 '17 at 02:54 PM

First go to:

C:\Program Files (x86)\Epic Games\4.xx\Engine\Source\Programs\UnrealBuildTool

right click on the "UnrealBuildTool" - Visual C# Project file, go to properties and remove the write protection.

Then open the "UnrealBuildTool" - Visual C# Project file with Visual Studio and look at the right site for the "Android" folder. Open it and click on the "UEDeployAndroid.cs" file.

Now you have to search for something like this:

alt text

In my Case it was at line 1544.

You can remove the permissions or just comment them out. But leave the first two lines as they are!

Note that the Engine needs some permissions to work. Here is a list i found in the forum:

 Minimum required:
 android.permission.WRITE_EXTERNAL_STORAGE

 Required for AdMob:
 android.permission.INTERNET
 android.permission.ACCESS_NETWORK_STATE

 OBB download from Google Play Store (working on for 4.8):
 com.android.vending.CHECK_LICENSE
 android.permission.INTERNET
 android.permission.WAKE_LOCK
 android.permission.ACCESS_NETWORK_STATE
 android.permission.ACCESS_WIFI_STATE

 Force Feedback:
 android.permission.VIBRATE

 InApp purchase:
 com.android.vending.CHECK_LICENSE
 com.android.vending.BILLING

 GearVR:
 android.permission.CAMERA

 These are also currently included, but I think they can be dropped:
 android.permission.READ_PHONE_STATE
 android.permission.GET_ACCOUNTS
 android.permission.MODIFY_AUDIO_SETTINGS

You can easily leave the minimum requirements in the "UEDeployAndroid.cs" – file and activate the other permissions later in the Project Settings. So you can have different permissions for each project.

In my case it looks like this now:

alt text

You only have to rebuild the "UnrealBuildTool". I suggest to build it new.

Note: If the Engine is updated, you have to repeat all the steps.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question