问题描述
是它实际上可以通过意向(或别的东西),如果该设备是目前在汽车模式,找出?我试图与一个具有全局变量的接收器做到这一点,但我想经历的onReceive后的变量不下去; - )
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 ;-)
所以有另一种方式?
谢谢!
推荐答案
我使用Google
配置UI_MODE_TYPE_CAR
。链接 - http://www.java2s.com/Open-Source/Android/Samples/techbooster/org/jpn/techbooster/sample/uiModeManager.java.htm
它提到
getSystemService(Context.UI_MODE_SERVICE).getCurrentModeType()
返回 Configuration.UI_MODE_TYPE_CAR
如果是这种情况。
getSystemService(Context.UI_MODE_SERVICE).getCurrentModeType()
will return Configuration.UI_MODE_TYPE_CAR
if it is the case.
这篇关于如何找出是否在汽车模式(安卓)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!