最近项目上要用到wifi 定位, 搜索了一些资料, 整理验证, 今天在android 2.3和4.0测试通过了,在这里做个记录.
1. wifi 定位首先要framework 支持,下面源码文件中的config_networkLocationProvider不能为空,应该配置如下
frameworks/base/core/res/res/values/config.xml
<!-- Component name of the service providing network location support. -->
<string name="config_networkLocationProvider">com.google.android.location.NetworkLocationProvider </string>
<!-- Component name of the service providing geocoder API support. -->
<string name="config_geocodeProvider">com.google.android.location.GeocodeProvider </string>
2. 从相同版本模拟器中(android2.3.1, 选择google API 9)建立模拟