Android - detect if app is running on watch or mobile phone

223 Views Asked by At

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?

0

There are 0 best solutions below