【发布时间】:2013-12-12 04:58:25
【问题描述】:
我正在开发一个 Android 应用程序,我需要使用 Mock Locations 测试我的应用程序,早上 5 点出门几乎 0ºC 并不是一个好主意!!。我正在使用 Google Play 服务 Location API,
所以,我阅读了 Google 文档并提出了使用 Mock Locations 的所有要求。
1 - 在 Manifest 上添加 ACCESS_MOCK_LOCATION 权限 -
<permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
2 - 选中开发者选项中的复选框以“允许模拟位置”。
3- 使用 mLocationClinet.setMockMode(true) 开启模拟模式;
但是,在执行时,执行 setMockMode 时出现下一个错误。
java.lang.SecurityException: Client must have ACCESS_MOCK_LOCATION permission to perform mock operations.
有类似问题的人吗?想法?
【问题讨论】:
标签: android testing google-play-services android-location