如何知道高精度模式器件 [英] how to know if device in high accuracy mode

查看:124
本文介绍了如何知道高精度模式器件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何才能知道是否该设备是高精度模式。

How can we know if the device is in high accuracy mode.

当在谷歌地图中的设备仅模式打开它要求你改变高精确度模式。我需要实现这样的事情。但我不能找到让我们知道位置模式的任何API。

When the Google map is opened in device only mode it ask you to change to high accuracy mode. I need to implement such a thing. But i couldn't find any API that let us know the location mode.

更新:我需要从code知道这一点。我需要知道,如果该设备是目前在设备仅模式,电池省电模式或高精度模式

update: i need to know this from code. i need to know if the device is currently in the device only mode, battery saver mode or high accuracy mode

推荐答案

在4.4奇巧

进入设置>位置

默认设备是唯一

preSS 模式

有三个选项

修改根据需要

如果u要设置

mLocationRequest=LocationRequest.create();
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);

如果u想知道

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
    try {
        locationMode = Settings.Secure.getInt(context.getContentResolver(),Settings.Secure.LOCATION_MODE);

        } catch (SettingNotFoundException e) {
        e.printStackTrace();
        }

    return (locationMode != Settings.Secure.LOCATION_MODE_OFF && locationMode == Settings.Secure.LOCATION_MODE_HIGH_ACCURACY); //check location mode

}else{
    locationProviders = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
    return !TextUtils.isEmpty(locationProviders);
}

问候
行家

regards maven

这篇关于如何知道高精度模式器件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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