Activating Network Location Provider in the Android Emulator?(在 Android 模拟器中激活网络位置提供程序?)
问题描述
是否可以在android模拟器上激活网络位置提供程序?也许是用假细胞?
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 请求位置更新才能使模拟位置数据起作用."(引自Android,文档,提供模拟位置数据)
"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)
我能想到的最接近的方法是从 位置管理器
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 模拟器中激活网络位置提供程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Android 模拟器中激活网络位置提供程序?
基础教程推荐
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- iOS4 创建后台定时器 2022-01-01
