```//build the geofence val fence = Geofen...
# android
r
Copy code
//build the geofence
        val fence = Geofence.Builder()
            .setRequestId("123")
            .setCircularRegion(latitude, longitude, radiusInMeters)
            .setExpirationDuration(Geofence.NEVER_EXPIRE)
            .setTransitionTypes(Geofence.GEOFENCE_TRANSITION_ENTER)
            .build()

        geofencingRequest = GeofencingRequest.Builder().apply {
            setInitialTrigger(GeofencingRequest.INITIAL_TRIGGER_ENTER)
            addGeofence(fence)
        }.build()


        //build pending intent
        val geofencePendingIntent: PendingIntent by lazy {
            val intent = Intent(activity, GeofenceReceiver::class.java)
            PendingIntent.getBroadcast(activity, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)
        }

        //request
        geofencingClient.addGeofences(geofencingRequest, geofencePendingIntent).run {
            addOnFailureListener {
                // display error
            }
            addOnSuccessListener {
                // move on
            }
        }
l
Have you registered the Broadcast Receiver in the manifest? https://developer.android.com/training/location/geofencing#RequestGeofences