Capture image without permission with Android 6.0

前端 未结 5 1129
庸人自扰
庸人自扰 2021-02-04 07:29

I need to let the user take a picture (from the gallery or from a camera app) with Android 6.0.

Because I don\'t need to control the camera, I wanted to use an intent as

5条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-04 08:14

    It is possible if you on android 4.4+, you can specify MediaStore.EXTRA_OUTPUT, to be a file under your package-specific directories

    Starting in Android 4.4, the owner, group and modes of files on external storage devices are now synthesized based on directory structure. This enables apps to manage their package-specific directories on external storage without requiring they hold the broad WRITE_EXTERNAL_STORAGE permission. For example, the app with package name com.example.foo can now freely access Android/data/com.example.foo/ on external storage devices with no permissions. These synthesized permissions are accomplished by wrapping raw storage devices in a FUSE daemon.

    https://source.android.com/devices/storage/

提交回复
热议问题