Storage Permission Added by Default?

DaveCarsonDaveCarson GBUniversity ✭✭✭

I've had a few users contact me about one of my apps asking why it requires access to their SD Card (which technically it doesn't - my code does not read/write directly to the phones storage)

I advise them that this was to allow the app to be installed/moved onto the SD Card and that Google Maps required access to enable it to cache the map tiles.
The former appears to have been a red herring and the latter appears to be no longer the case.

So, I decided that I would remove the permission and hence remove the confusion about why it was required.

Herein lies the problem. Even though I've removed it from the manifest it still appears in the permission list when deployed to a device (KitKat and Marshmallow).

Confused about this I created a clean project (File > New Project etc) and after checking the manifest to ensure no permissions were defined and with no code changes it too has the 'read the contents of your SD card' permission listed! Why?

From my point of view I'm happy that I can remove if from the manifest (after adding a check for the suitable version of Google Play Services) but if users see it in the permission list when it is installed then I expect questions to continue.

Does anyone know why the storage permission is being added and if there is anything I can do to remove it?

Tagged:

Best Answer

  • Accepted Answer

    You have to remove this line in AssemblyInfo.cs.

    // Add some common permissions, these can be removed if not needed
    [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]

Answers

  • @DaveCarson Did you ever found out the reason why the storage permission was added?

  • DaveCarsonDaveCarson GBUniversity ✭✭✭

    @JeroenvanWarmerdam.5306 : No - I'm afraid I didn't. No response in here and I found nothing on the web - although I've not search recently.

  • McahitAktasMcahitAktas USMember

    i have same problem. :/

  • MENADJELIAYacineMENADJELIAYacine USUniversity
    Accepted Answer

    You have to remove this line in AssemblyInfo.cs.

    // Add some common permissions, these can be removed if not needed
    [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]

  • DaveCarsonDaveCarson GBUniversity ✭✭✭

    @MENADJELIAYacine said:
    You have to remove this line in AssemblyInfo.cs.

    // Add some common permissions, these can be removed if not needed
    [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]

    Well blow me down - despite editing that file a number of times to update the Version etc I never noticed that (even though they are only a couple of lines below).

    Good spot @MENADJELIAYacine

  • DaveCarsonDaveCarson GBUniversity ✭✭✭

    You know - I thought that this was the answer, something that clearly indicated that it was adding the Storage permission to the manifest. But no - I've now gotten around to removing it for a fresh release and the Storage permission remains. I've upgraded, uninstalled/reinstalled and it's still there.

    Sorry @MENADJELIAYacine - seems like there is another reason for this one.

  • It seems that Xamarin.Forms.Maps implicitly adds that permission:
    https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Maps.Android/Properties/AssemblyInfo.cs#L22

    Is this necessary? It causes quite a confusion for our app users.

Sign In or Register to comment.