makeImageRequest doesn't work and will throw errors in background service on CIQ4.0 devices(VENU2) .
the same code will work on devices before CIQ4.0 such as fenix6.I am sure the error comes from the background service,
because the error is still there even when I delete all the code from onUpdate(dc).
Error: Permission Required
Details: Module 'Toybox.Graphics' not available to 'Background'
Stack:
- getType() at D:\grmn\prj\di\connectiq\toolchain\mbsimulator\submodules\technology\monkeybrains\virtual-machine\api\WatchUi.mb:4098 0x300043d6
- initialize() at D:\grmn\prj\di\connectiq\toolchain\mbsimulator\submodules\technology\monkeybrains\virtual-machine\api\Graphics.mb:919 0x300013fb
- <Toybox_Graphics_BitmapReference_>>initialize>() at D:\grmn\prj\di\connectiq\toolchain\mbsimulator\submodules\technology\monkeybrains\virtual-machine\api\Graphics.mb:998 0x30001551
the background code is below
using Toybox.Background as Bg;
using Toybox.System as Sys;
using Toybox.Communications as Comm;
using Toybox.Application.Storage as AS;
(:background)
class BackgroundService extends Sys.ServiceDelegate {
function initialize() {
Sys.ServiceDelegate.initialize();
}
function onTemporalEvent() {
Comm.makeImageRequest("https://t1.picb.cc/uploads/2021/11/13/wYuQxt.png",null,{:palette =>[0xff0000],:maxWidth => 100,:maxHeight => 100,:dithering => 1}, method(:OnReceiveimg));
}
function OnReceiveimg(responseCode, data){
if(responseCode == 200){
AS.setValue(4,data);
}
Bg.exit(responseCode);
}
}