如何将网络位置(而非GPS)发送到android模拟器

Ang*_*Koh 5 android location android-emulator

我想在没有GPS且仅具有网络位置的模拟设备上测试我的应用。我已经为没有GPS的设备创建了硬件配置文件。

如何使用网络位置将LAT / LONG位置发送到此模拟器?我在模拟器上看到的唯一选项是将位置发送为GPS数据点。

背景

将于2016年10月15日对API 21进行一些平台更改,由于这些更改,我想测试我的应用程序的用户体验。这包括在仿真设备上进行测试

  • 网络位置不带GPS
  • 带GPS且无网络位置

根据https://developer.android.com/guide/topics/location/strategies.html#Permission的说明,我们现在需要将以下uses-feature之一包含在清单中

android.hardware.location.network或android.hardware.location.gps

我的应用程序需要两者之一,因此我包括以下内容

<uses-feature
    android:name="android.hardware.location"  />
<uses-feature
    android:name="android.hardware.location.gps"
    android:required="false" />
<uses-feature
    android:name="android.hardware.location.network"
    android:required="false" />
Run Code Online (Sandbox Code Playgroud)

以下问题包含有关更改的一些信息:

什么时候需要android.hardware.location.gps和android.hardware.location.network?

Android:创建没有GPS硬件的模拟器