Skip to main content

Locations

AFCore.locations() covers everything about the member and the places around them: the gyms and stores they save, automatic gym visits at their favorite gyms, map and place search, and a way to suggest places that are missing or fix ones that are wrong. It replaces the deprecated facilities() and map() modules, which keep working while you migrate.

What you can do​

Favorites​

Members save the gyms and stores they care about, set a primary location, and remove them again. A favorite can also be muted: it stays in the list, but its notifications and automatic visits pause until it is unmuted.

Visit detection​

Turn the member's favorite gyms into automatic gym visits. The SDK watches them in the background, across app restarts and reboots, once the member grants "Always" location. See Gym Visits.

Fill a map with places around a point or inside the visible region, filtered by category, type, amenities or name. Each result says whether it is already one of the member's favorites, so a pin can offer Add directly.

Turn free text into a real place, with the member's recent searches kept on the device for quick reuse.

Nominate a location​

Let the member suggest a gym or store that is not in the network yet: pick a category and a type from the server's catalogs, find the place with place search, and submit.

Report a problem​

Tell the reviewers that something about an existing location is wrong (address, hours, contact details, closed, duplicate), optionally with the member's corrections.

My submissions​

Show the member everything they nominated or reported, with its review status and the reviewer's note.

Location sharing​

With the member's consent, share their location with the server so it can evaluate every place on its side, retail stores included. It is off by default and turned on in the SDK configuration.

Key APIs​

CallWhat it is for
getFavorites(), addFavorite(), removeFavorite()The member's saved places
muteFavorite(), unmuteFavorite()Pause and resume a favorite
startVisitDetection(), stopVisitDetection()Automatic gym visits from favorite gyms
subscribeToVisitDetectionStatus(), subscribeToVisitEvents()Drive a visit-detection toggle and react to arrivals
getLocationsByRadius(), getLocationsByViewPort()Map search
searchPlaces(), getRecentPlaceSearches()Place search and recent searches
getLocationCategories(), getLocationTypes(), nominateLocation()Nominate a missing place
reportLocationProblem()Report a problem with a location
getMySubmissions()The member's nominations and reports
AFCoreConfig.Builder.locationSharingEnabled(), shareLocationNow()Opt in to location sharing, share once now

Example: find a gym, save it, start automatic visits​

lifecycleScope.launch {
try {
// Gyms within 5 miles of the member
val nearby = AFCore.locations().getLocationsByRadius(
centerLatitude = here.latitude,
centerLongitude = here.longitude,
radiusMiles = 5.0,
filter = AdvancedLocationFilter(categoryCodes = listOf("FITNESS"))
)
showPins(nearby.items)

// The member saves a pin; visits at favorite gyms are then credited automatically
AFCore.locations().addFavorite(locationId = picked.id)
AFCore.locations().startVisitDetection()
} catch (e: AFException) {
showError(e.message)
}
}

Moving from facilities() and map()​

DeprecatedReplacement on locations()
facilities().get()getFavorites(), keeping FAVORITE and MUTED (it also returns EXCLUDED)
facilities().update(facilityId, verified = true)addFavorite(locationId)
facilities().delete(facilityId)removeFavorite(locationId)
facilities().startMonitoring() / stopMonitoring()startVisitDetection() / stopVisitDetection()
facilities().nominateFacility(...)nominateLocation(nomination)
facilities().getNominatedFacilities()getMySubmissions()
map().getNearbyFacilities(...)getLocationsByRadius(...)
map().getFacilitiesByViewPort(...)getLocationsByViewPort(...)
AFCore.heartbeat / fireDebugHeartbeat()locationSharing / shareLocationNow()

The deprecated calls keep working, so you can migrate one screen at a time.

Learn more​

  • API Reference for every locations() call and model.
  • Complete integration guides, including the nomination form, map screens and visit-detection setup, are in AIDE Docs.