Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

onApplyWindowInsets is not called in CanvasWatchFaceService.Engine

I am developing a watch face using CanvasWatchFaceService.Engine

I need to detect if watch is round or square.

I overrided onApplyWindowInsets, but it is not called.

Shall I set a specific listener or something like that?

like image 941
AVEbrahimi Avatar asked Dec 02 '25 08:12

AVEbrahimi


2 Answers

In my experience, onApplywindowInsets only gets called when you're using Theme.DeviceDefault, or a theme descending from it. It won't get called if you're using a completely custom theme.

So in the manifest for your watch face, your application tag needs to look something like this:

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.DeviceDefault" >

Or if you have a theme for the watch face service, that will override it.

like image 90
Sterling Avatar answered Dec 05 '25 14:12

Sterling


In my experience, onApplyWindowInsets is not called unless android:

isScrollContainer = "true"

is set to any view in layout.

like image 43
Takao Sumitomo Avatar answered Dec 05 '25 13:12

Takao Sumitomo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!