IQ Error in background on accessing Rez

Hi,

I get since several weeks IQ errors via ERA when I access Rez in background. It worked quiet some time but suddenly it stopped working without doing changes on my side. I believe it has something to do with firmware updates. I use the very same code in glance view as well as in the normal view and have no problems there. The code which crashes is here:

	function resolveDescription(d) {
		if (d == :walk) {
			return WatchUi.loadResource( Rez.Strings.walk );
		}
		if (d == :move) {
			return WatchUi.loadResource( Rez.Strings.move );
		}
		if (d == :inPlan) { 
			return WatchUi.loadResource( Rez.Strings.inPlan );
		}
		if (d == :goalReached) {
			return WatchUi.loadResource( Rez.Strings.goalReached );
		}

		return WatchUi.loadResource( Rez.Strings.run );
	}

It creates the message which shall be given to the user if a certain condition is valid. The strings are scoped as background:

    <string id="walk" scope="background">WALK</string>
    <string id="run" scope="background">RUN</string>
    <string id="inPlan" scope="background">IN PLAN</string>
    <string id="move" scope="background">MOVE</string>
    <string id="goalReached" scope="background">GOAL REACHED</string>

Maybe I should note here that the default strings are overwritten by further languages (german and spanish) which are scoped as background as well. But I could imagine, that Garmin doesn't test all those specific environments if new firmwares are released. 

Are there any problems known regarding this topic?

  • What is the error you see in the ERA, and which devices are involved and their FW versions?

  • Hi Jim,

    this is the error, I see:


    Error Name: Unhandled Exception
    Occurrences: 14
    First Occurrence: 2020-11-13
    Last Occurrence: 2020-11-16
    Devices:
    fēnix® 6X Pro / 6X Sapphire / 6X Pro Solar / tactix® Delta Sapphire / Delta Solar / Delta Solar - Ballistics Edition / quatix® 6X / 6X Solar / 6X Dual Power: 12.20
    App Versions: v0.0.9
    Languages: deu
    Backtrace:
    bgbg.resolveDescription:77
    bgbg.onTemporalEvent:64

  • I returned temporarily a fix string in the function resolveDescription and now the backgrounding works again on the real watch. It seems that the watch has a problem to resolve the Rez string although it is declared with background.

  • I fixed it by returning a fix string:

    	function resolveDescription(d) {
    		
    		//return "Run";
    		
    		if (d == :walk) {
    			return "Walk";
    			return Application.loadResource( Rez.Strings.walk );
    		}
    		if (d == :move) {
    			return "Move";
    			return Application.loadResource( Rez.Strings.move );
    		}
    		return "Run";
    		return Application.loadResource( Rez.Strings.run );
    	}
    

    This is a workaround since the english strings are returned. Garmin, can you please fix that in the firmwares or in the simulator since both differs regarding the behaviour.

  • I started having this issue for Connect IQ 2.4.5 devices e.g. Forerunner 735 XT. This was working in the simulator before.

    Error:

    Error: Illegal Access (Out of Bounds)

    Details: Failed invoking <symbol>

    Code

    resource = Rez.Strings.notifyBurningFat;

    I thought that somehow this was due to the new 4.0.0 SDK being stricter (which I love), and we have to re-declare the resource strings without scope="background" for these devices (since that version os CiQ doesn't support them - generates a warning), but this didn't work.

    Does anyone know what could be the problem?

  • Scoping resources is only available starting with 3.1.3

    • Add a “scope” attribute support for all resources to allow access for background and glance processes."
  • The problem seems to affect the all CiQ 2.4.x devices when running in the Background context.
    All the other Strings that are also annotated work fine in foreground.

    I guess the question is, if Background annotation works in the code for these older devices, but scopes do not, how do I make localised Rez strings available in Background context?

    Can I even use Rez Strings in background context in CiQ pre 3.1.3?

    This (getting Rez Strings from background context) was not throwing errors in the simulator before. That is why I'm bothered by this. But if this is the correct behaviour, then I have to swallow and follow.

    If only there was a changelog of simulator/device fixes one could refer to...

  • There are only two watches that support a background service and are CIQ 2.  The vahr and fr735,  As I mentioned this scoping came about in 3.1.3.  Off the top of my head, I can't think of any watches that are still 3.0x.

    All the change logs are in the readme file in the SDK.  Here's the full one for 3.1.3:

    v3.1.3

    General Changes

    • Add device support for the vívoactive® 4 and 4s.
    • Add device support for the VenuTm.
    • Add device support for the fēnix® 6 series.
    • Add device support for First Avenger and Captain Marvel.
    • Add support for AMOLED burn-in protection for watch faces.
    • Add support for widget glances.
    • Add the new Application.loadResource() API to allow background processes to load resources.
    • Add era and era.bat to easily launch retrieve crashes for an app using the command line.

    Simulator Changes

    • Fix an issue that caused the simulator fail connecting to BLE devices after restart.
    • Fix a bug where using exitTo would not shut down the current app before launching the target app.
    • Fix issue that would cause an app crash when switching between media player modes.
    • Fix bugs that could cause the simulator to lock-up.
    • Update edge520plus, edge530 and edge830 data field layouts to match devices.
    • Increase audio content provider app max memory to 512kb for multiple devices.
    • Fix screen and button position issues with the Edge 130 device configuration.
    • Distribute MSVC 14 runtime libraries with Windows simulator builds.
    • Fix inconsistencies between memory limits on devices and the simulator.
    • Fixed a simulator hang issue when closing.
    • Fix menu2 icon positioning on 218x218 resolution devices.
    • Fix an issue that eclipse console no longer display information after switching to “Glance View” or any app restart.
    • Fix an issue that Sim can’t connect to BLE device after restart.

    Compiler Changes

    • Fix an issue that prevented the provided TextArea fonts from being used.
    • Fix bug in the resource compiler, which prevented bitmaps from being defined within drawable-lists if the bitmap’s x,y coordinates were not defined in the xml.
    • Add a compiler error if an app that supports backgrounding won’t fit within a background app’s memory limitations.
    • Add a compiler warning if backgrounding support is specified and no :background annotations are encountered.
    • Add a compile time error when duplicate declaration flags (ex: static static var foo;) are used.
    • Add a “scope” attribute support for all resources to allow access for background and glance processes.
    • Convert the error for no animation support to a warning allowing developers to use a runtime check instead when updating older apps (with low minimum sdk versions) to use animations.
    • Add compile time error in the scenario that a developer attempts to build an app for a device that is not supported in the project’s manifest file.
  • Thanks for the hint regarding the change log, there is very useful information there! Thumbsup

    Now, regarding the problem: I have users that use a Forerunner 735 XT, the simulator states that it supports CiQ 2.4.5 in the latest firmware.

    This means there is no scope support for Rez. Would that mean I cannot use Rez Strings in background context?



  • Yes.  A device with 3.1.3 or newer can handle it, but not 2.x devices.