1. Are you ready for the Galaxy S20? Here is everything we know so far!

Copy images from gallery in app directory targetSDKVersion > 28

Discussion in 'Android Development' started by Jens Bartsch, Sep 27, 2020.

  1. Jens Bartsch

    Jens Bartsch Lurker
    Thread Starter

    Hallo, sorry for my bad english.

    I have problems with the value "targetSdkVersion" in the build.gradle related to copying images from the Gallery to my APP directory. The background is that I use MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA take several pictures in a row with the camera APP and then display them in a list. Unlike with MediaStore.ACTION_IMAGE_CAPTURE you can't save the pictures directly here and with the second you can only take a picture.

    If set the value 28 as targetSdkVersion, I can easily copy images from the Gallery to my APP directory (after appropriate permission) and no more at 29 (otherwise no change). srcFile.exist() returns true at both values, FileTools.fileCopy(src,dest) returns true at value 28 and the file is copied. If 29 is a value, the value is returned false and the file is not copied. The app needs to be uninstalled and reinstalled once when changing values, there are no problems with the update from 28 to 29.
    I think this has something to do with it, as can be seen from https://developer.android.com/distribute/best-practices/develop/target-sdk.
    • Scoped storage
    • External storage access is limited only to an app-specific directory and to specific types of media that the app has created.

    Does anyone have an idea what alternative I have to copy the images from the DCIM directory to my app directory. Other apps do the same.

    greetings Jens
     


Loading...

Share This Page

Loading...