在 Android 中添加地理围栏时出错(状态代码 1000) [英] Error adding geofences in Android (status code 1000)

查看:25
本文介绍了在 Android 中添加地理围栏时出错(状态代码 1000)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 onAddGeofencesResult(int statusCode, String[] geofenceRequestIds) 回调中遇到错误,statusCode = 1000.

I am getting an error in the onAddGeofencesResult(int statusCode, String[] geofenceRequestIds) callback with statusCode = 1000.

我启用了 GPS 和 WiFi.我也有 Google Play 服务,我可以跟踪我的位置并请求更新.为什么我无法添加地理围栏?即使从文档示例应用程序中,我也无法添加地理围栏.我收到以下 Toast 消息:

I have my GPS enabled and my WiFi. I also have Google Play Services and I am able to track my location and request updates. Why am I not able to add geofences? I am not able to add geofences even from the documentation sample app. I get the following Toast message:

添加地理围栏:失败,错误代码 1000 GeofenceRequestIds=[1,2,1,2]"

"Add Geofences: Failure, error code 1000 GeofenceRequestIds=[1,2,1,2]"

来自文档(statusCode 1000):

From the documentation (statusCode 1000):

public static final int GEOFENCE_NOT_AVAILABLE

地理围栏服务现在不可用.通常这是因为用户在设置中关闭了位置访问 >位置访问.

Geofence service is not available now. Typically this is because the user turned off location access in settings > location access.

常量值:1000 (0x000003e8)

Constant Value: 1000 (0x000003e8)

推荐答案

当用户不同意在 Settings->Location->模式:

You get GEOFENCE_NOT_AVAILABLE (code '1000') when user disagrees to "Use Google' location services" in Settings->Location->Mode:

修复:

  • 转到设置->位置->模式
  • 设置仅限设备(使用 GPS 确定您的位置)"
  • 设置任何其他选项以获取弹出窗口(例如高精度(使用 GPS、Wi-Fi 和移动网络来确定位置")
  • 显示使用 Google 的位置服务"对话框
  • 选择同意"

这篇关于在 Android 中添加地理围栏时出错(状态代码 1000)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆