检查位置在Android Location Client中是否不可用 [英] Check if Location is unavailable in Android Location Client

查看:91
本文介绍了检查位置在Android Location Client中是否不可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检查Location Client是否能够提供任何位置.除了调用普通的定位系统服务,还有其他方法吗?

I would like to check if Location Client is able to provide any location. Is there any way to do so, apart from calling normal location system service?

推荐答案

当时接受的答案是正确的.但是最近随着 SettingsApi的出现,情况发生了变化. 它可让您检查设备上是否提供了定位服务,并且Google在

The accepted answer was correct at the time. But in recent times things have changed with the availability of the SettingsApi It allows you to check if the location services are available on the device and there is a complete example provided by google on github that shows how to use this API. The sample code will prompt the user to enable location if it's switched off.

这篇关于检查位置在Android Location Client中是否不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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