在Android模拟器激活网络位置提供者? [英] Activating Network Location Provider in the Android Emulator?

查看:230
本文介绍了在Android模拟器激活网络位置提供者?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能激活的Andr​​oid模拟器的网络位置提供商?也许用假CELLID?

Is it possible to activate the network location provider on the android emulator? Maybe with a fake cellid?

推荐答案

我相信,你想达到什么是不可能的时刻。你不能把模拟位置数据到仿真器的网络位置提供商。

I believe that what you want to achieve is not possible at the moment. You cannot put mock location data to the emulator's network location provider.

提供了模拟的位置数据被注入GPS定位数据,所以你必须请求,以便模拟位置数据进行工作从GPS_PROVIDER位置更新。 (从的Andr​​oid,文档,提供模拟位置数据)

"Providing mock location data is injected as GPS location data, so you must request location updates from GPS_PROVIDER in order for mock location data to work." (Quote from Android, Documentation, Providing Mock Location Data)

我可以拿出最接近的将是创建一个从测试提供商<一href="http://developer.android.com/reference/android/location/LocationManager.html#addTestProvider%28java.lang.String,%20boolean,%20boolean,%20boolean,%20boolean,%20boolean,%20boolean,%20boolean,%20int,%20int%29">Location经理

The closest thing I can come up with would be to to create a "Test Provider" from the Location Manager

public void addTestProvider (String name, boolean requiresNetwork, boolean requiresSatellite, boolean requiresCell, boolean hasMonetaryCost, boolean supportsAltitude, boolean supportsSpeed, boolean supportsBearing, int powerRequirement, int accuracy)

和设置参数的 requiresNetwork requiresCell requiresSatellite 相应。然后你可以从把假的位置给供应商:

and set the arguments requiresNetwork, requiresCell and requiresSatellite accordingly. Then you can from put fake locations to that provider:

public void setTestProviderLocation (String provider, Location loc)

这是接近但不完全是你问什么。

That's close to but not exactly what you asked for.

这篇关于在Android模拟器激活网络位置提供者?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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