Hi guys,
I’m encountering an error when using Toybox.Communications.makeImageRequest() with wifi / sync mode.
Problem:
When downloading images with makeImageRequest() via wifi in sync mode in a subclass of Communications.SyncDelegate the app tends to crash. Here is the error code (which always gets printed twice):
Error: Array Out Of Bounds Error
Details: failed inside handle_image_callback
Time: 2021-01-27T10:58:37Z
Part-Number: 006-B3226-00
Firmware-Version: '5.10'
Language-Code: deu
ConnectIQ-Version: 3.2.3
Filename: my_file_name
Appname: MyAppName
Observations:
- Everything works fine on simulator. The Problem only occurs on my physical device (Venu)
- The error can occur with all data types that I tested (png, jpeg, bmp)
- The error does not occur if I set a color palette in the arguments (only tested with a 4 color palette)
- The error does not occur if I load f.e. a simple one-color-all-red-image
- The Image size (pixels) can be higher or lower than maxWidth and maxHeight, the error occurs in both cases
- The dithering mode makes no difference
- Some images succeed to be downloaded but get cut of when displayed (2/3 of image are black) and there’s a small multi-color stripe between the correct area and the black. Again only on real device, simulator works fine.
- Tried it with images from our backend, with images from other websites and with own image from a third-party server: https://i.ibb.co/8rFBZP5/dummy.png
- Maybe this is related: Although ANIMATIONS can be downloaded and stored with makeWebRequest() they crash when played. Also only on the real device, simulator works fine.
Code:
class MySyncDelegate extends Communications.SyncDelegate {
function executeImageDownload(imageUrl) {
var parameters = null;
var options = {
// request works if this is active:
//:palette => [ Graphics.COLOR_ORANGE,
// Graphics.COLOR_DK_BLUE,
// Graphics.COLOR_BLUE,
// Graphics.COLOR_BLACK ],
:maxWidth => System.getDeviceSettings().screenWidth,
:maxHeight => System.getDeviceSettings().screenHeight
// Makes no difference:
//:dithering => Communications.IMAGE_DITHERING_NONE
};
Communications.makeImageRequest(imageUrl, parameters, options, method(:saveData));
// Aaaand here it crashs. Callback is not getting reached.
}
}
Example File:
I’ tried to attach one example image but "quota restrictions" forbid it. Here's a link though: https://i.ibb.co/8rFBZP5/dummy.png
Question:
Downloading images (and even more downloading animations) is pretty important for our app. And we have only a venu to test with. Can you tell me if this error occurs on all devices or possibly only on venu?
Kind regards