Acknowledged
over 1 year ago

Issue with Complications.exitTo() - exception if launching an app (widget)

On a real devices (tested on Venu 2+ SW 17.04) Complications.exitTo() exception is thrown in CIQ watchface on Venu2+, if launching an CIQ app (widget). Built in Complications are ok (like BodyBattery). On Simulator it works correctly.

// code snippet of Ui.WatchFaceDelegate
var compAKWEA; // stored complication
var devValue; // for testing

if (Toybox has :Complications) {
    var iter = Complications.getComplications();
    var complication = iter.next();
    while (complication != null) {
		if ("AKWEA".equals(complication.shortLabel)) {
            compAKWEA = complication;
        }
	    complication = iter.next();
	}
}

// code section inside onPress(evt)
try {
	if (compAKWEA != null) {
		devValue = compAKWEA.shortLabel; // devValue set correct to shortLabel ("AKWEA"), so correct Complication
		Complications.exitTo(compAKWEA.complicationId);
	}
	return true;
} catch (e) {
	if (devValue != null) {
		devValue = devValue + "e"; // "e" is added, so exception was thrown
	}
	return false;
}

If onPress is executed 1st time, devValue is set to "AKWEA" (so correct Complication) but app is not started, so seems to be exitTo() is simply not executed. If onPress executed 2nd time, devValue ist set to "AKWEAe", so exception was thrown during execution of exitTo().

Important to know is, that complication is receiving data from app correctly, so subscription to Complication is working in general, it's "only" exitTo() with issues.

Permission in manifest.xml set

<iq:uses-permission id="ComplicationSubscriber"/>

Here is resource.xml of to be launched app:

<resources>
	<strings>
        <string id="AppName">xyz</string>
	    <string id="lWeatherLong">xyz</string>
    	<string id="lWeatherShort">AKWEA</string>
	</strings>	

	<complications>
	    <complication id="0" access="public"
	        longLabel="@Strings.lWeatherLong"
	        shortLabel="@Strings.lWeatherShort"
	        icon="@Drawables.Complication"
	        glancePreview="false">
	        <faceIt defaultText="@Strings.AppName" />
	    </complication>
	</complications>
</resources>

On different device than Venu2+ not tested (because I'm not owning any other devices which supports Complications)

  • With latest beta for Venu2+ issue is fixed, hopefully that's also the case for finally deployed FW. Thanks.

  • Make sure you are running the newest Firmware on the device, maybe even the latest public beta.

    In the year or so I've been using complications, I've seen issues with exitTo(), mainly with complications published with CIQ. onPress will work, then with newer FW it might not, but then works with the next FW.

    In onPress, I always do exitTo() inside a try/catch, where i don't do anything in the catch, so just ignore the exception.

    It's nothing in my code, either with the publisher or consumer, as my code doesn't change.  Just a change in firmware,  What the user sees with the catch in onPress means the onPress just apprears to be ignored if the FW isn't handling it correctly.  No app crashes, etc.