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?
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.