No permission for UID to access URI error on Android Application

前端 未结 1 904
迷失自我
迷失自我 2021-01-07 09:41

I am building a simple app to select an image or take one from camera and crop it. However, it is throwing me this error

java.lang.SecurityException: Uid 100         


        
相关标签:
1条回答
  • 2021-01-07 10:23

    Try this out:

    Android Manifest:

    <uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
    

    Get image by URI

    i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    startActivityForResult(i, CHOOSE_IMAGE);
    

    This forces the older gallery to open.

    Now you can get the result on your onActivityResult with:

    Uri selectedImageURI = data.getData();
    
    0 讨论(0)
提交回复
热议问题