1

I have an app which client use on a mobile phone or watches with Android (NOT Wear OS). The watches have "standard" Android OS (Example: https://www.aliexpress.com/item/32980744300.html).

I want somehow detect if the app is running on phone or watches. I tried:

 val uiModeManager: UiModeManager = getSystemService(UI_MODE_SERVICE) as UiModeManager
    if (uiModeManager.getCurrentModeType() == android.content.res.Configuration.UI_MODE_TYPE_WATCH) {
        android.util.Log.d("EagleEye", "Running on a Watches")
    } 

But it's not working.

Do you have some other tips? Suggestions?

Pepa Zapletal
  • 2,879
  • 3
  • 39
  • 69
  • 1
    Perhaps something in the current `Configuration` could tell you? The `screenLayout` and `touchscreen` fields and `isScreenRound()` method look promising. – Ben P. Feb 06 '20 at 18:16
  • 1
    perhaps using screen configurations would help or you can use device linked layouts like SW-800dp and one smaller for the watch, alternatively you can get the dimension of the screen and compare to the minimum you require. – Raykud Feb 06 '20 at 18:19

0 Answers0