无法在模拟器上检测位置,Android Studios

时间:2019-10-22 04:45:14

标签: java android-studio android-emulator google-location-services

我在Github(https://github.com/android/location-samples/tree/master/BasicLocation)上创建了一个Android应用程序,该应用程序演示了如何使用Google Play服务Location API获取设备的最后已知位置。

但是,当我尝试运行该应用程序时,收到一条Toast消息,内容为“未检测到位置。请确保在设备上启用了位置。”

enter image description here

我已向清单添加了以下权限:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

此外,仿真器的扩展控件会读取我当前的经/纬度坐标

enter image description here

我想知道如何解决这个问题。

1 个答案:

答案 0 :(得分:-1)

运行google map应用并授予其所有权限,然后在地图显示后启动您的应用。 检查这一点更多的信息。 Emulator's Location simulation not working

相关问题