I'm trying to detect when my app is run on a round Wear device, but I can't get the OnApplyWindowInsetsListener to work from this post.
Can I just attach this to any view object in my layout, or my layout itself? When is it called? I can't get the listener to fire. Any code examples would be much appreciated.
I create and add this ImageView to my main layout in my OnResume method:
backgroundImage = new ImageView(this);
backgroundImage.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View view, WindowInsets windowInsets) {
if (windowInsets.isRound()){
Log.d("DEVELOPER", "......screen is round");
}
Log.d("DEVELOPER", "......windowinsets called");
return null;
}
});