Search code examples
androidandroid-intentbroadcastreceiver

How to find out if in Car Mode (Android)?


is it actually possible to find out via intent (or something else) if the device is currently in Car Mode? I tried to do this with a receiver that has a global variable, however I guess the variable doesn't survive after going through the onReceive ;-)

So is there another way?

Thanks!


Solution

  • I got this link after googling for

    Configuration UI_MODE_TYPE_CAR

    . Link - http://www.java2s.com/Open-Source/Android/Samples/techbooster/org/jpn/techbooster/sample/uiModeManager.java.htm

    It mentions

    getSystemService(Context.UI_MODE_SERVICE).getCurrentModeType() will return Configuration.UI_MODE_TYPE_CAR if it is the case.