Is there a function or property that I could call or reference from a module to tell if it is running in a watch face or app or something else? If it's in application or watchui I'm not finding it.
Is there a function or property that I could call or reference from a module to tell if it is running in a watch face or app or something else? If it's in application or watchui I'm not finding it.
What is your use case? Shared code between a watch face and a device app, or using a onPress to launch something from a watch face?
For a widget/super app, you can tell if a glance started it with
If this is some common code that you use both in watchface or app then either you can pass a parameter (probably to the constructor that you call from your app where you know if it's a WF or an app) or add a global variable that you set in your app's constructor and you read from everywhere where you need to know it
This is what I figured, and is what I'm doing right now. I was just hoping for a proper solution, but this is CIQ so I've learned to keep my hopes low.
Random idea on this old thread: have you considered trying to access something that's available on one platform but not the other? For example, you can't access the tone generator in a watch face but you can from an app.
Just checking for some things even in a try/catch will result in uncatchable fatal errors. You just have to know.