2

I have a terrible question.. I hope there is anyone who know this problem..

In EXPO App which is a wrapper API for React Native, How can Expo Image picker example app can access Gallery(external storage) without requesting any external storage access permission to user???

original source code is here.. https://docs.expo.io/versions/latest/sdk/imagepicker/

I tried with removing any askAsync(CAMERA_ROLL.permission) or getAsync(CAMERA_ROLL.permission). So the example app has no permission about accessing external storage... BUT!! I press the button, It access the Gallery.... How can it be possible?? I double check permission on the app, but there is no granted permission to external storage...

Please let me know... I think it is the appropriate thing which firstly asked permission, then access the external storage..

P.S I tested it with android phone only.

no permission on this app

gui on app

after pushing the button, it access the external storage!

i have never checked permissions..

user8282818
  • 111
  • 2
  • 9
  • you are running you code in EXPO CONTAINER that have those permissions, look at app info permission settings of app expo. Also it depends on Android OS version too. Try to set off the Storage permissions and retry. – Oleg Oct 06 '19 at 14:40
  • thank you for the answer. but i tried it after build as standalone android app. it means as apk file. i install apk then i run the app. none of permission is on, but it can access the gallery!! – user8282818 Oct 06 '19 at 22:55

1 Answers1

0

To stop expo app from having this permission, do the following:

  1. Remove all reference to the permission requests (That you already did)
  2. Remove the Image launcher (but it seems you don't want to do that)
  3. Clear the expo application permission of media access

Step 3 is what you are looking for, to clear application settings go to your phones settings -> application management -> select expo app -> permissions and clear the gallery/media permission.

Now when you run the application again you will not be able to access the gallery even if you press the button as you mentioned and if you include the getAsync to request for permission you will be prompt with asking for permission.


EDIT:

To explicitly set permissions for stand alone applications modify your app.json file and add the "permissions" parameter under the android configurations there, by default expo uses all permissions of your device. specify there the permissions you want your application to have.

Please refer to this link for further details on how to configure your app.json file.

Hope this helps!

Abdeen
  • 922
  • 9
  • 30
  • 1
    thank you for the answer.. but i tried it in clear permission state, as none of permission... also my android version is 9. how can it possible?? it can access the gallery with no permission.. – user8282818 Oct 06 '19 at 22:58
  • no its totally impossible, did you remember to clear cache and clear data for the `Expo` app from your application management. Also this is what i mean by clear expo permission https://www.tomsguide.com/us/android-marshmallow-app-permissions,review-3287.html on step 3 instead of Android Wear it should be the Expo app – Abdeen Oct 07 '19 at 09:52
  • thank you for the answer. but i do check no permission on this app setting. also i build it as apk.. i install and just run apk with no permissions, i double check it! but it can access the external Storage.. how can... – user8282818 Oct 07 '19 at 23:22
  • i add some screenshot – user8282818 Oct 07 '19 at 23:30
  • Hey! i just edited my answer please follow this and i think you should be good to go! – Abdeen Oct 08 '19 at 09:50
  • Thank you for the EDIT comment!!! I have question about EDIT comment^^; You said the apk which is made with Expo IDE(API), has already all permissions. But, How the apk get the all permissions without any question to user? – user8282818 Oct 08 '19 at 11:26
  • I build the apk(image up there posted) with EXPO IDE, and i run apk, but there is no permission queries to user... but it can access the external storage(image up there posted) also, i check the apk permission in setting, but there is none of permission... – user8282818 Oct 08 '19 at 11:33