首页 > 代码库 > Android GMS无法通过网络定位
Android GMS无法通过网络定位
前言
欢迎大家我分享和推荐好用的代码段~~
声明
欢迎转载,但请保留文章原始出处:
CSDN:http://www.csdn.net
雨季o莫忧离:http://blog.csdn.net/luckkof
正文
framework/base/core/res/res/values/config.xml
<string-array name="config_locationProviderPackageNames" translatable="false">
<!-- The standard AOSP fused location provider -->
<item>com.android.location.fused</item>
<!-- MTK add for GMS -->
<item>com.google.android.location</item>
<item>com.google.android.gms</item>
<!-- MTK add end -->
</string-array>
请在alps\external\wpa_supplicant_8\wpa_supplicant\bss.c中的如下函数中修改
static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src,
struct os_time *fetch_time)
{
struct timespec ts;//add this line;
dst->flags = src->flags;
os_memcpy(dst->bssid, src->bssid, ETH_ALEN);
dst->freq = src->freq;
dst->beacon_int = src->beacon_int;
dst->caps = src->caps;
dst->qual = src->qual;
dst->noise = src->noise;
dst->level = src->level;
/* dst->tsf = src->tsf;*/ //delete this line
//add below code
if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0)
dst->tsf = src->tsf;
else
dst->tsf = ts.tv_sec*1000000 + ts.tv_nsec/1000;
//end
calculate_update_time(fetch_time, src->age, &dst->last_update);
}
如果是编译模块进行验证,请先执行./mk &project_name mm external/wpa_supplicant_8/wpa_supplicant
将alps/out/target/product/project_name/system/bin/wpa_supplicant push到system/bin/下,再执行命令
adb shell chmod 755 system/bin/wpa_supplicant
重启系统后验证
谢谢!