Using the Core Framework
Signing In
When integrating with the core framework, the first task that must be done is establishing a session with the ExtremeLocation Cloud.
FTMSession.signIn(appKey:"…key…",appSecret:"…secret…",username:nil){ (error:Error?)in }
The call to signIn can happen anywhere in the application flow, but it should be called before any other core framework API. For background processing to work properly, such as when iOS launches the app due to coming into range of a beacon, the signIn call needs to happen early on, such as in application(_:didFinishLaunchingWithOptions:). To obtain an app key and secret, please seehttps://manage.extremelocation.com.
Receiving Experiences
FTMExperienceManagerDelegate.experienceManagerDidReceiveExperiences() FTMExperienceManager.delegate=selffuncexperienceManagerDidReceiveExperiences(_experiences:Set<FTMExperience>) {// Process the experiences.}
The Beacon Manager
Some apps might only be interested in processing experiences. Other apps might also want access to the beacons in the surrounding environment. The FTMBeaconManager class maintains a list of in-range beacons and communicates state changes with its delegate.
Any time the beacons in the surrounding environment change, FTMBeaconManagerDelegate.beaconManagerDidRangeBeacons() is called. To access the latest beacons, call FTMBeaconManager.beacons.
Finding the Nearest Beacon
The FTMNearestBeaconRequest class allows a request to be made for the beacon that is nearest to the current device. The beacons in the surrounding environment are analyzed, and the ExtremeLocation Cloud determines which beacon is the nearest.