Kindle Fire Camera Fails with platform 2.9.1

I recently upgraded to platform 2.9.1. The android build fails to save images from the only on the Kindle Fire tablets. Oddly, the camera functions normally in the Android emulator using Android 5 and 9 and on a Samsung Galaxy 9 phone. However, on an old Kindle Fire running Fire OS 5.x and a new Kindle Fire HD 10 running Fire OS 7 the camera fails to return images to the app (there is no “OK” button present after taking a picture. After taking a picture control returns to the app with no image present)

I see the following errors in the logs:
[ INFO] 03-02 16:17:38.417 14684 14815 D Forge : Native call file.getScriptURL with task.params: {“file”:{“uri”:“file:///storage/emulated/0/Android/data/com.kidreports.app.client/files/Pictures/1614727058117.jpg”,“name”:“Image”,“type”:“image”,“width”:1920,“height”:1440}}
[ INFO] 03-02 16:17:38.419 14684 14815 W Forge : Requested unknown permission: android.permission.READ_EXTERNAL_STORAGE
[ INFO] 03-02 16:17:38.419 14684 14815 W Forge : File object requires property: endpoint
[ INFO] 03-02 16:17:38.437 14684 14684 D Forge : Returned: {“content”:“file:///storage/emulated/0/Android/data/com.kidreports.app.client/files/Pictures/1614727058117.jpg”,“callid”:“3DAF0281-8A3F-4E89-8344-ACF8BBB3FE9F”,“status”:“success”}
[ INFO] 03-02 16:17:38.440 14684 14684 E Forge : [object Object] – From line 7653 of https://localhost:31929/src/scripts/scripts.js

The offending lines of code are as follows:
forge.file.URL(file, function (url) {
url = forge.httpd.normalize(url);

The project is using the latest version of file - version 2.26.

I see a problem with permissions from reading external storage in the error logs. Do you have an suggestions on how to fix this problem?

I’m not too optimistic you’ll get this to work as Kindle’s Fire OS is not fully API compatible with Android.

Incompatible permission API’s and broken Android Intents are some of the specific issues that keep coming up with it.

That said, a few things to try:

  1. Camera capture functionality has been moved out of forge.file and into the forge.capture module.
  2. You no longer need to use the forge.httpd.normalize method.

Can you try to get the device logs for when the error occurs so we can see the exact permissions error by running the following in a terminal:

/path/to/android/sdk/platform-tools/adb logcat

Not sure if its related or not but I had similar issues, not with kindle but on the migration to 2.9. The return URI is not the same as it was before so had to update our code to use the new methods (we got a permission error before doing this too)

1 Like