Android Permissions and the Manifest.xml

Does anyone know how the permissions in the manifest are found and used?

I tried renaming the ‘Plugins’ folder in hopes that the Manifest in there wouldn’t be used for my build. But somehow I think maybe Unity is searching for it or something when it’s building?

My main thought is that I want 2 ‘Plugins/Android’ folders with different configurations for my paid and free versions. Or maybe just 1 for my free with my ad set-up in there.

But my paid seems to have the same permission requirements of my free even though I don’t have ads in it.

Anyone have any suggestions or know how to hide that Manifest when doing certain builds?

You will have to replace the file manually, there is no way to make such a “version used in build” seperation through automatisms commonly (there is one and thats postprocess + some configuration file that tells the postprocess which file to use and which is fed from a custom editor you wrote but thats kind of is it)

It would be nice to know what exact file I need to replace though to reduce the grunt work. Like just rename folder and rename AndroidManifest.xml…?

Well it doesn’t look like anything I do helps. For some reason the AndroidManifest.xml that Unity is building into the StagingArea has those permissions in it. I guess maybe it’s remembering them somehow from a previous build or something.

Does anyone know where it’s getting those from?

I’m getting a few complaints about Permissions (surprise surprise)… I’d really like to offer my paid version permission free.

Build your APK with Unity.

Use apktool (Google Code Archive - Long-term storage for Google Code Project Hosting.) or another tool of your choosing to unpack the APK. Replace the AndroidManifest.xml with one that reflects what you want. Repack the APK. Sign it. Align it. Ship it.

My script:

java -jar apktool/apktool.jar d Racer.apk Temp/repack_apk/
cp apktool/AndroidManifest.xml Temp/repack_apk/AndroidManifest.xml
cp apktool/strings.xml Temp/repack_apk/res/values/strings.xml
java -jar apktool/apktool.jar b Temp/repack_apk/
jarsigner -verbose -keystore apktool/my-release-key.keystore Temp/repack_apk/dist/Racer.apk alias_name
zipalign -v 4 Temp/repack_apk/dist/Racer.apk Racer_Xperia.apk
1 Like

Part from the editor, the other part are likely the “base” version thats present in the unity folder itself where the rest of the player comes from.

But you can rewrite them after building with your own content (post process build player script) to replace them with your own content.

Permission free: a few permissions are required, otherwise it will not run at all.
Questions is which you want to get rid of

@zerostride - thanks I’ll give that a try.

@dreamora - I just tested my 1.0 version I kept handy and sure enough it has no permissions when i check it via Manage Applications on the phone. There is no ‘Permissions’ section at all.

The ones that are now there are:
READ_PHONE_STATE
ACCESS_NETWORK_STATE
CHECK_LICENSE

No idea where it’s getting those from… it’s cached them somewhere from a build I did using the Mobclix unitypackage that’s offered in the forum. But now I can’t get rid of them.

Read phone state and check license are required
Phone state to pause the application when the phone is phoning, sleeping etc as android does not sleep applications as iOS does

check license is potentially required for the LVL license verification (isGenuine etc checks)

access network state is potentially added as consequence of the network checkbox in the player settings.

Strong chances you know better than me.

I’m a bit skeptical given that I load my 1.0 app and it has no permissions listed at all in the Manage Applications area.

Also a reviewer gave me 5 stars when I first released saying explicitly “No permissions required!” and now he’s knocked it down to 4 saying “Update now requires phone state and identity? Wtf?”

I guess I’ll need to make a clean project to verify.

EDIT: I do recall adding the isGenuine though. Maybe that’s what’s adding them. Could be it needs to add more than one for that. I’ll have a look there. Thanks.

thinking about it, the network state could actually be consequence of isGeniune too because the license is verified against googles server.

But I really don’t see why anyone cuts stars to 4 for this permissions as you don’t access anything user stored on it at all with these permissions, so its not like you invade the system or read data you shouldn’t.
People that worried should really not use smartphones at all as thats not a world for people such a paranoia.
Or what I wanted to say to you with that: Don’t worry about it and change the wording in the form that you express the clear statement that you access no user data.

BOOM! That was it.

It was the isGenuine.

Thank you for walking me through that.

I’m noticing that Android users are a strange paranoid bunch… they are crazy sensitive about those permissions.

Apparently it’s catching because I’m getting that way too.

Being sensitive about it is fine, I check them too.

But being paranoid makes only sense if you are about it for relevant things like address book access, mail access and alike. (none the less I’ve whatsapp installed and many of those paranoianies too)

But the 3 permissions here are generic ones that potentially every game has that uses Googles official license verification system.

The permission in the manifest is automatically added to reflect what you use in your scripts. Removing those could cause your application to malfunction in random ways.

An empty scene will not require any permissions and therefor has a clean permission list. Adding things like Vibrate or WWW to a script will add the necessary permissions for those to function.

It seems (with Unity 5.1.0f1 at least), READ_PHONE_STATE, INTERNET, and ACCESS_NETWORK_STATE are all on even for a completely empty project.

My users have complained about READ_PHONE_STATE, and it really does look bad when suggested to users.

1 Like

I’m running into this same issue. I was priding myself on lack of permissions and now I have to slam my users with these three?!

1 Like

Me too :frowning: Could be related to the new Network-Components they introduced in 5.1.

I didn’t notice this post and created another thread about the READ_PHONE_STATE permission that is added by Unity 5.1.
I want to know why Unity 5.1 needs this permission,
My apps are child directed, I need a good answer for my users because this will lead to bad ratings and questions,

Unity … Is this a bug? What can we do to remove this permission? Where can we find info on this change? It is not mentioned in the Unity 5.1 release notes.

Yeah just discovered the phone state permission today. That is a bummer and I’d like to see that fixed in a future version unless the components using it are actually used! I wonder if the networking needs it to know when to break off connections and such during some kind of interruption from a call or something…

I have the same doubts about these permissions.
some support expert could give a response about that?