在 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 to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)