3

I am attempting to get complex data from a complication using Watch Face Format. I'm wondering if there's any way to split a string from complication data, based on a separator like a comma or space?

Per the WFF complication documentation, there is a complication type called WEIGHTED_ELEMENTS. If you get the [COMPLICATION.WEIGHTED_ELEMENTS_WEIGHTS] complication data, it is delivered as "a space-separated list of element weights".

One would think there would be an obvious way to split this string based on the space separator as described, but in the WFF arithmetic expression documentation, the closest function I can find is subText(,,), which is a substring function.

What gives? Is there something I'm missing here, or did they really add a complication data type without also giving developers any way to parse the data?

0

2 Answers 2

0

It seems there is no way to do what I was hoping for. Per this Google I/O tutorial, a special type of Stroke element was added specifically for GOAL_PROGRESS and WEIGHTED_ELEMENTS complications called WeightedStroke, which handle the space-separated list of data automatically.

0

Yep, as you've seen, the intention is that this is value is fed directly into the weights attribute of WeightedStroke.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.