如何找出是否在汽车模式(安卓)? [英] How to find out if in Car Mode (Android)?

查看:206
本文介绍了如何找出是否在汽车模式(安卓)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是它实际上可以通过意向(或别的东西),如果该设备是目前在汽车模式,找出?我试图与一个具有全局变量的接收器做到这一点,但我想经历的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

Configuration UI_MODE_TYPE_CAR

。链接 - <一个href="http://www.java2s.com/Open-Source/Android/Samples/techbooster/org/jpn/techbooster/sample/uiModeManager.java.htm" rel="nofollow">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.

这篇关于如何找出是否在汽车模式(安卓)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆