I am learning android development and trying to develop a simple android watchface with kotlin. For now I am stucked with complications. I found a way how to make it work with default system data like how to show a step counter or a current date:
val leftComplication = ComplicationSlot.createRoundRectComplicationSlotBuilder(
id = ComplicationConfig.Left.id,
canvasComplicationFactory = defaultCanvasComplicationFactory,
supportedTypes = ComplicationConfig.Left.supportedTypes,
defaultDataSourcePolicy = DefaultComplicationDataSourcePolicy( SystemDataSources.DATA_SOURCE_DAY_OF_WEEK ),
bounds = ComplicationSlotBounds( RectF(
ComplicationBounds.LEFT_COMPLICATION_BOUNDS.left,
ComplicationBounds.LEFT_COMPLICATION_BOUNDS.top,
ComplicationBounds.LEFT_COMPLICATION_BOUNDS.right,
ComplicationBounds.LEFT_COMPLICATION_BOUNDS.bottom
)
) ).setDefaultDataSourceType(ComplicationType.SHORT_TEXT)
.build()
(Full source code is available by https://github.com/SI7-Agent/AndroidXComplicatedDigitalNeon)
So that is working but it is returning a complication with somewhere generated complicationData. So the question is: Can I use this complication data generated with system data and modify it according to my preferences: for example, change icon if it's supported and don't modify other data?
I know about creating a custom Broadcast receiver and ComplicationDataSourceService. But in this case I must to provide all of the data I need to show including sensors' value if I want to use step counter, for example.
I appreciate any help. Thanks