We have an widget which downloads workouts to a 2.x watch and then allows user to run them.
Users have (quite reasonably :) asked if it is possible for the widget to remember the last downloaded workout and offer to run it if no network is available.
I'm banging my head against the docs trying to find a way to do this. I've tried a number of approaches without luck
a) Remember downloaded intent
If the workout successfully downloads we obviously can call toIntent() to run it, but I the intent cannot be saved to an app property as it is not a string
b) Remember downloaded intent parameters and recreate intent
There do not appear to be any documented accessors to determine the parameters to recreate it.
c) Remember the download object and use it to recreate intent
Again, there object appears to be opaque with no way to serialise and recreate
d) Remember the name of the workout downloaded, then use iterate through PersistedContent to find a match
Its easy enough to save the downloaded workout name to an app property, then iterate through PersistedContent workouts, but while the object passed to the download callback has a getName() there does not appear to be any way to extract the name from a PersistedContent workout. So I can iterate through them and blindly call toIntent() on any of them but they are all completely opaque.