在 Android 中添加地理围栏时出错(状态码 1000)

Error adding geofences in Android (status code 1000)(在 Android 中添加地理围栏时出错(状态码 1000))
本文介绍了在 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- 中不同意使用 Google 位置服务"时,您会得到 GEOFENCE_NOT_AVAILABLE (code '1000')>模式:

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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

How can I use CClistview in COCOS2d Android?(如何在 COCOS2d Android 中使用 CClistview?)
cocos2d-android: how to display score(cocos2d-android:如何显示分数)
Sqlite database not copied from asset folder Android(Sqlite 数据库未从资产文件夹 Android 复制)
SQLite Database Copy Appears Corrupted When Generated by Device and not Emulator(SQLite 数据库副本在由设备而不是模拟器生成时出现损坏)
Android file copy(安卓文件拷贝)
Android how to detect Copy event of Edittext in android(Android如何在android中检测Edittext的Copy事件)