diff --git a/packages/jsActions/mobile-resources-native/CHANGELOG.md b/packages/jsActions/mobile-resources-native/CHANGELOG.md index 5c77e7258..0419dcff6 100644 --- a/packages/jsActions/mobile-resources-native/CHANGELOG.md +++ b/packages/jsActions/mobile-resources-native/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +### Fixed + +- Fixed an issue where the `TakePicture` and `TakePictureAdvanced` actions failed to capture photos on Android. + ## [12.1.0] Native Mobile Resources - 2026-6-10 - Updated react-native from version 0.83.4 to 0.84.1. diff --git a/packages/jsActions/mobile-resources-native/src/camera/TakePicture.ts b/packages/jsActions/mobile-resources-native/src/camera/TakePicture.ts index 324d6c15d..8cd9ab8c8 100644 --- a/packages/jsActions/mobile-resources-native/src/camera/TakePicture.ts +++ b/packages/jsActions/mobile-resources-native/src/camera/TakePicture.ts @@ -118,9 +118,10 @@ export async function TakePicture( function storeFile(imageObject: mendix.lib.MxObject, uri: string): Promise { return new Promise((resolve, reject) => { - fetch(uri) - .then(response => response.blob()) - .then(blob => { + NativeModules.MxFileSystem.read(uri.replace("file://", "")) + .then((nativeBlob: unknown) => { + const blob = new Blob(); + Object.assign(blob, { data: nativeBlob }); // eslint-disable-next-line no-useless-escape const filename = /[^\/]*$/.exec(uri)![0]; const filePathWithoutFileScheme = uri.replace("file://", ""); diff --git a/packages/jsActions/mobile-resources-native/src/camera/TakePictureAdvanced.ts b/packages/jsActions/mobile-resources-native/src/camera/TakePictureAdvanced.ts index c141b842e..6a9dc43f6 100644 --- a/packages/jsActions/mobile-resources-native/src/camera/TakePictureAdvanced.ts +++ b/packages/jsActions/mobile-resources-native/src/camera/TakePictureAdvanced.ts @@ -171,9 +171,10 @@ export async function TakePictureAdvanced( function storeFile(imageObject: mendix.lib.MxObject, uri: string): Promise { return new Promise((resolve, reject) => { - fetch(uri) - .then(response => response.blob()) - .then(blob => { + NativeModules.MxFileSystem.read(uri.replace("file://", "")) + .then((nativeBlob: unknown) => { + const blob = new Blob(); + Object.assign(blob, { data: nativeBlob }); // eslint-disable-next-line no-useless-escape const filename = /[^\/]*$/.exec(uri)![0]; const filePathWithoutFileScheme = uri.replace("file://", "");