Android Question Camera Intent Error on 7.0.0

yiankos1

Well-Known Member
Licensed User
Longtime User
Good morning,
I have a galaxy S6 with 7.0.0 and i try this camera intent. At example, everything works fine. When i implement same code at my project i get this error:
B4X:
(FileUriExposedException) android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/com.dreamon.crosswod/files/tempimage.jpg exposed beyond app through ClipData.Item.getUri()
and camera does not open. Code is identically the same.
Thank you for your time.


EDIT:
manifest:
B4X:
AddManifestText(
<uses-permission
  android:name="android.permission.WRITE_EXTERNAL_STORAGE"
  android:maxSdkVersion="18" />
)

AddApplicationText(
  <provider
  android:name="android.support.v4.content.FileProvider"
  android:authorities="$PACKAGE$.provider"
  android:exported="false"
  android:grantUriPermissions="true">
  <meta-data
  android:name="android.support.FILE_PROVIDER_PATHS"
  android:resource="@xml/provider_paths"/>
  </provider>
)

CreateResource(xml, provider_paths,
   <external-files-path name="name" path="shared" />
)
I have added file providers because i share pic at other part of app.
 
Last edited:

yiankos1

Well-Known Member
Licensed User
Longtime User
You can set it to 23 to avoid this issue.

The tutorial will not work with targetSdkVersion set to 24. It is safer to use targetSdkVersion 23 as for the FileProvider method to work, the camera app must support it.
Thats right. It worked. But i think it should work with 24 someday.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…