Search code examples
javaandroid-wear-data-apiandroid-wear-2.0

Initialise specific complication without user input - android wear api


I want to be able to read data from a complication, like the weather or steps count, without having to create a complication for the user to select which complication to show in the watch face.

Is it possible to initialise a specific complication, like the weather or steps, without the input of the user?

Cheers!


Solution

  • Yes it is possible, but you are limited to the system providers, or your custom complication providers.

    Custom provider as default:

    https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine#setDefaultComplicationProvider(int,%20android.content.ComponentName,%20int)

    https://developer.android.com/training/wearables/data-providers/exposing-data-complications#provider-specified-safe-watch-faces

    System providers as default:

    https://developer.android.com/reference/android/support/wearable/watchface/WatchFaceService.Engine#setDefaultSystemComplicationProvider(int,%20int,%20int)

    https://developer.android.com/reference/android/support/wearable/complications/SystemProviders