Complications questions

hi mates,

I think I am not "smart" enough or lack of skill to understand the complications,

I read the CoreTopic again and again but in vain ;)

So far I did test that:

function onPress(clickEvent){
		var c = clickEvent.getCoordinates();
		if(c[0]>gW*0.4&&c[0]<gW*0.6&&c[1]>gW*0.4&&c[1]<gW*0.6){
				Sys.println("ok");
    			var K = new Complications.Id(Complications.COMPLICATION_TYPE_SUNSET);

				if(K!=null){
					Sys.println(Complications.getComplication(K).value);
					try{
            			Complications.exitTo(K);Sys.println("exitTo OK");
						return true;
					} catch ( e ) {Sys.println("AppNotInstalled");}
				}
		}
	}

it seems to work, I mean I have the value and the "exitTo OK"

I guess the similator does not simulate the app opening right?

That is the only code block which contains Complications code.

So now my question is, what is the interrest of "suscribe" etc?

have a great day

  • hi, in case it happens to someone else, the culprit was the try/catch,

    here is the new lines of code which works like a charm:

    if(wD!=null&&wD>0){
    	wD=whichComp(wD);
    	if(wD==null){return false;}
    	if(wD){
    		var k = new Comp.Id(wD);
    		if(k){Comp.exitTo(k);}
    		return true;
    	}
    }

  • hi again!

    So as written everything wotks like a charm on simulator and real device,

    BUT on simulator, if I test with  venu2system6preview, as soon as I "touch" the screen I get fatal crash with only:

    Error: Symbol Not Found Error
    Details: Failed invoking <symbol>
    Stack: 
    
    Encountered app crash.

    Have you had the venu2system6preview ok on your side?

    Can also someone tell me how to do an efficient Try/catch?

    when I try to do it (as written before), it works well on simulator but make the device crash on real.

    have a great day

  • oh!! I've just seen that onPress is not compatible with the Venu2, that is probably why... That means Venu2 won't be compatible with this?! very odd...

  • Is it normal for the battery complication to receive an update every second in the sim? E.g.

    Battery 16:16:22 = 74
    Battery 16:16:23 = 74
    Battery 16:16:24 = 74
    Battery 16:16:25 = 74

    I'm assuming that on a real device it will only update when the level changes? (Will test and verify and post results)

  • After testing this on an actual device the results are the same. It's not what I expected, which was that it would only receive updates if the value changed, after all it's called onComplicationChanged in the SDK documentation and seems unnecessary and inefficient to receive an update if the value is the same.

    I've seen the same in the sim for subscribing to stress and assume the on-device results will be the same, although in the glance stress does actually update often, so it's less of an issue for that metric.

    It's easy enough to work around this by using a local variable and only updating it if the value differs, but I think a few processing cycles can be saved if the subscriber code didn't have to compare and check if the value has changed from it's previous state. I realize an updated FW might cause unexpected results for people who rely on the current behavior, but maybe an extra option can be provided for those who only want to listen for actual updates.

    From a log file on the device (Venu 2):

    view initialize
    Battery 19:08:47 = 81
    Battery 19:08:47 = 81
    Battery 19:08:48 = 81
    Battery 19:08:49 = 81
    Battery 19:08:50 = 81
    Battery 19:08:51 = 81
    Battery 19:08:52 = 81
    Battery 19:09:52 = 81
    Battery 19:10:52 = 81
    Battery 19:11:12 = 81
    Battery 19:11:13 = 81
    Battery 19:11:14 = 81
    Battery 19:11:15 = 81
    view initialize
    view initialize
    view initialize
    view initialize
    view initialize
    Battery 19:11:43 = 81
    Battery 19:11:44 = 81
    Battery 19:11:45 = 81
    Battery 19:11:46 = 81
    Battery 19:11:47 = 81
    Battery 19:11:48 = 81
    Battery 19:11:48 = 81
    (gap due to low power mode)
    Battery 19:11:54 = 81

  • Any ideas why an App isn't allowed this permission? Seem like a silly limitation to me.

    The following permission is invalid for app type 'watch-app': 'ComplicationSubscriber'

  • You can only subscribe in a watch face.  Not sure exactly why, but it's the same with native apps

    From the doc on complications:

    At the heart of the complications system is a publisher/subscriber system. The system publishes complication data for subscribers to consume. Connect IQ device apps and audio content providers can publish complication data, but only watch faces can subscribe to complication information.

  • Thanks, saw that in the docs, it's silly and limits what can be done :( I think some data can only be obtained via complications. Do you think Garmin might change that?

  • I suspect the limitation has to do with the fact that they can not handle the launching aspect of the complication. I agree it would be nice compromise if the data sharing aspect was available in all app types.