在Android 2.3中,isProviderEnabled(LocationManager.GPS_PROVIDER)始终返回false [英] isProviderEnabled(LocationManager.GPS_PROVIDER) always returns false in android 2.3

查看:565
本文介绍了在Android 2.3中,isProviderEnabled(LocationManager.GPS_PROVIDER)始终返回false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用

警报对话框,以便他可以启用GPS,但是在我启用

Alert Dialog to so that he can enable the GPS, But after I enable

Api 2.3上的使用无线网络复选框,并返回上一个活动

the Use Wireless Network checkbox on Api 2.3 and return to previous Activity

它再次向我显示设置警报对话框"屏幕.

its again showing me the Alert Dialog for settings screen.

因为这行:

isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); 

总是返回false.

我正在使用以下代码重定向到位置设置.

I am using below code to redirect to Locations Setting.

Intent im=new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(im);

但是在Api 5.1.1上,相同的代码可以正常工作并返回true

为什么会这样?

预先感谢...

推荐答案

实际上,我用于测试的2.3版设备没有GPS,因此我总是得到错误的值,当我不小心阅读时发现了它我手机的规格

Actually the device with version 2.3 that I was using for testing was not having GPS so I was always getting the value false and I figured it out when I accidently read my phone's specification

这篇关于在Android 2.3中,isProviderEnabled(LocationManager.GPS_PROVIDER)始终返回false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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