4

I have been trying to implement Geofencing for an android app, and right now after initializing the GeoFenceRequest as per Google's Documentation and then adding it with the GeoFencingClient

geofencingClient.addGeofences(geoFenceRequest, geofencePendingIntent).addOnSuccessListener {
        Log.d(TAG, "GeoFence Added")
    }.addOnFailureListener {
        Log.d(TAG, "GeoFence Failed to Add")
    }

i get this error

com.google.android.gms.common.api.ApiException: 1004: 

and i cannot find any documentation describing anything related to it at all

Mahmoud Omara
  • 533
  • 6
  • 22

2 Answers2

6

found the solution apparently 1004 is the app lacks permissions from the device, i was missing the background location permission for android 10. this is the documentation for the status codes: https://developers.google.com/android/reference/com/google/android/gms/location/GeofenceStatusCodes

Mahmoud Omara
  • 533
  • 6
  • 22
2

I changed my app's location setting from

ALLOWED ONLY WHILE IN USE

to

ALLOWED ALL THE TIME

and it worked.

enter image description here

Qadir Hussain
  • 8,721
  • 13
  • 89
  • 124