I want to provide a Wear OS watchface that comes with an Android application, which controls several properties for the watchface. I set everything up in Android Studio, and I'm done with the mobile side and the watchface renderer. Now I face the issue of exchanging data between mobile and watch, because I'd like to send the properties set on my phone to the watch. I read something about a DataItem
, and I guess that one is going to help me with the data exchange.
Now once the data is exchanged and the watchface is set up accordingly, I want both the app and the watchface to "remember" these settings for when they restart. Is there a way to persist DataItems
, or are there other options (other than just saving it separately on both devices)?
DataItem
s do persist, but they're not entirely reliable, and you still need a UI for configuration - ideally on both devices. I've opted for sharing a single XML file that renders into a PreferenceScreen
on both, and I built something I call PrefSyncService
to automagically keep the SharedPreferences
in sync between the two devices.