Version fuse and so
fuse v1.5.0 mac sierra hight
What do I expect?
I expect the URL of the photo to be printed on the console correctly when i use takephoto of Fuse.Camera Module
What’s going on?
An exception thrown System.err: android.os.FileUriExposedException
. This happens with Android versions > = 8.0. With earlier versions and with iOS it works properly.
I have noticed that the cause is having added these specs in the project file:
"Android": {
"SDK": {
"BuildToolsVersion": "25.0.3",
"CompileVersion": 25,
"MinVersion": 16,
"TargetVersion": 25
}
}
Reproduce the issue
Mainview.ux
<App>
<JavaScript>
var camera = require('FuseJS/Camera');
var cameraRoll = require("FuseJS/CameraRoll");
function takePhoto(){
console.log("take photo");
camera.takePicture(1920, 1080).then(function(newImage) {
//HERE CRASH
console.log(newImage.path);
}).catch(function(error) {
cameraRoll.getImage().then(function(imageRoll) {
console.log(imageRoll.path);
}.bind(this),
function(error) {
console.log("error", JSON.stringify(error));
});
});
}
module.exports={takePhoto:takePhoto}
</JavaScript>
<Button Clicked="{takePhoto}" Text="Take photo"/>
</App>
*.unoproj
{
"RootNamespace":"",
"Packages": [
"Fuse",
"FuseJS",
"Fuse.Camera",
"Fuse.CameraRoll"
],
"Includes": [
"*"
],
"Android": {
"SDK": {
"BuildToolsVersion": "25.0.3",
"CompileVersion": 25,
"MinVersion": 16,
"TargetVersion": 25
}
}
}
EXCEPTION
System.err: android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/com.sandos.precheckin/cache/images/IMG_696f3530-2789-419a-aa44-1f9a788925b9.jpg exposed beyond app through ClipData.Item.getUri()
01-09 18:23:22.701 22775 22775 W System.err: at android.os.StrictMode.onFileUriExposed(StrictMode.java:1960)
01-09 18:23:22.701 22775 22775 W System.err: at android.net.Uri.checkFileUriExposed(Uri.java:2348)
01-09 18:23:22.701 22775 22775 W System.err: at android.content.ClipData.prepareToLeaveProcess(ClipData.java:942)
01-09 18:23:22.701 22775 22775 W System.err: at android.content.Intent.prepareToLeaveProcess(Intent.java:9850)
01-09 18:23:22.701 22775 22775 W System.err: at android.content.Intent.prepareToLeaveProcess(Intent.java:9835)
01-09 18:23:22.701 22775 22775 W System.err: at android.app.Instrumentation.execStartActivity(Instrumentation.java:1610)
01-09 18:23:22.702 22775 22775 W System.err: at android.app.Activity.startActivityForResult(Activity.java:4487)
01-09 18:23:22.702 22775 22775 W System.err: at android.app.Activity.startActivityForResult(Activity.java:4445)
01-09 18:23:22.702 22775 22775 W System.err: at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:842)
01-09 18:23:22.702 22775 22775 W System.err: at com.foreign.Android.ActivityUtils.StartForResultJava72(ActivityUtils.java:55)
01-09 18:23:22.702 22775 22775 W System.err: at com.Bindings.ExternedBlockHost.StartForResultJava72(ExternedBlockHost.java:416)
01-09 18:23:22.702 22775 22775 W System.err: at com.Bindings.ExternedBlockHost.callUno_Uno_Permissions_Permissions_Succeeded60(Native Method)
01-09 18:23:22.702 22775 22775 W System.err: at com.foreign.Uno.Permissions.Permissions.permissionRequestSucceeded(Permissions.java:33)
01-09 18:23:22.702 22775 22775 W System.err: at com.Bindings.ExternedBlockHost.permissionRequestSucceeded(ExternedBlockHost.java:364)
01-09 18:23:22.703 22775 22775 W System.err: at com.fuse.Permissions.onRequestPermissionsResult(Permissions.java:93)
01-09 18:23:22.703 22775 22775 W System.err: at com.fuse.App.onRequestPermissionsResult(App.java:260)
01-09 18:23:22.703 22775 22775 W System.err: at com.sandos.precheckin.SandosCheckin.onRequestPermissionsResult(SandosCheckin.java:133)
01-09 18:23:22.703 22775 22775 W System.err: at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:7419)
01-09 18:23:22.703 22775 22775 W System.err: at android.app.Activity.dispatchActivityResult(Activity.java:7270)
01-09 18:23:22.703 22775 22775 W System.err: at android.app.ActivityThread.deliverResults(ActivityThread.java:4264)
01-09 18:23:22.703 22775 22775 W System.err: at android.app.ActivityThread.handleSendResult(ActivityThread.java:4312)
01-09 18:23:22.703 22775 22775 W System.err: at android.app.ActivityThread.-wrap19(Unknown Source:0)
01-09 18:23:22.703 22775 22775 W System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1644)
01-09 18:23:22.703 22775 22775 W System.err: at android.os.Handler.dispatchMessage(Handler.java:106)
01-09 18:23:22.704 22775 22775 W System.err: at android.os.Looper.loop(Looper.java:164)
01-09 18:23:22.704 22775 22775 W System.err: at android.app.ActivityThread.main(ActivityThread.java:6494)
01-09 18:23:22.704 22775 22775 W System.err: at java.lang.reflect.Method.invoke(Native Method)
01-09 18:23:22.704 22775 22775 W System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
01-09 18:23:22.704 22775 22775 W System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)))))