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

2020-03-25 07:45发布

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!

1条回答
祖国的老花朵
2楼-- · 2020-03-25 08:39

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.

查看更多
登录 后发表回答