I am currently developing a custom watch face for my smartwatch using CanvasWatchFaceService in Android Studio and coding in Kotlin. To ensure compatibility, I am targeting API Level 28. My custom watch face includes an icon that launches an activity in another app when clicked.
However, I have encountered a usability issue where the watch face is still considered visible even when it is not. This leads to unintended clicks and a poor user experience. For example, when a user swipes up to read notifications or swipes down to open settings, the icon is still clickable, causing the activity to launch unintentionally (even though the icon and watch face are not visible in this situation).
I have attempted to address this issue by toggling clickability using onVisibilityChanged when the watch face is not visible. While this solution works when the watch face is turned off or if you are in the app menu, it does not resolve the issue when there is an overlaid screen caused by swiping behavior.
I have also tried using logging statements for functions like onAmbientModeChanged, onDestroyed, and onSurfaceChanged, but have not found the function that is triggered when there is an overlaid screen.
Any guidance on how to address this issue would be greatly appreciated.