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 模拟器中激活网络位置提供程序?


基础教程推荐
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01