Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
549 views
in Technique[技术] by (71.8m points)

geolocation - Error adding geofences in Android (status code 1000)

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

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:

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

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.

Constant Value: 1000 (0x000003e8)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

To fix it:

  • go to Settings->Location->Mode
    enter image description here
  • set "Device only (Use GPS to determine your location)"
  • set any other option to get the popup (e.g. "High accuracy (Use GPS, Wi-Fi and mobile networks to determine location")
  • dialog ""Use Google' location services" is shown
  • choose "Agree"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...