Any code examples for watchfaces to go to a widget via a touch? For example, I render heart rate on my watch face. The user touches the heart. Can I then render the heart rate widget?
Any code examples for watchfaces to go to a widget via a touch? For example, I render heart rate on my watch face. The user touches the heart. Can I then render the heart rate widget?
The answer to all of your questions is yes, although technically your app doesn’t render the heart rate widget, your app asks the system to open the app associated with the native heart rate complication…
Here's a simple watch face that shows how to do exactly what you want to do for heartrate, along with a bunch of other things like scalable fonts and wheelchair mode.
Look at the delegate at about line 228 in ComplexWFView.mc
"onPress"
It checks where you are pressing the screen and if it's in a good place, does the exitTo() to launch the glance.
The answer to all of your questions is yes, although technically your app doesn’t render the heart rate widget, your app asks the system to open the app associated with the native heart rate complication. Note that the user has to long press the appropriate area of the watchface, a simple touch is not enough. (Watchfaces can only detect long presses, not any other kind of touch like short press, swipe or drag.)
CIQ store app (Crystal-Tesla, a fork of the popular Crystal watchface):
[https://apps.garmin.com/en-US/apps/cfdfdbe4-a465-459d-af25-c7844b146620]
Github source code:
[https://github.com/SylvainGa/crystal-face]
Specific code for launching the app associated with a complication:
[https://github.com/SylvainGa/crystal-face/blob/master/source/CrystalView.mc#L842-L875]
Here's a simple watch face that shows how to do exactly what you want to do for heartrate, along with a bunch of other things like scalable fonts and wheelchair mode.
a zip of the watch face is in the first post.
jim_m_58awesome. I'm looking through the code. It makes sense in regards to heart rate corresponding to the complication or activity info (line 183 in /ComplexWF/source/ComplexWFView.mc). My question is where is the code for the touch? is that inherent to a complication?
Look at the delegate at about line 228 in ComplexWFView.mc
"onPress"
It checks where you are pressing the screen and if it's in a good place, does the exitTo() to launch the glance.