Overview
RadarIndoorsProtocol defines the interface for indoor positioning providers that can be integrated with the Radar SDK. This protocol enables the SDK to perform indoor scans within specified geofences to determine precise indoor locations, such as floor level and position within a building.
Indoor positioning providers implement this protocol to offer Wi-Fi fingerprinting, Bluetooth beacon scanning, or other technologies for indoor location determination.
Required Methods
startIndoorScan(_:forLength:withKnownLocation:completionHandler:)
Initiates an indoor positioning scan within a specified geofence.The unique identifier of the geofence where the indoor scan should be performed. This typically corresponds to a building or venue configured in the Radar dashboard.
The duration of the indoor scan in seconds. Longer scans generally provide more accurate results but consume more battery and take longer to complete.
An optional known location to assist with the scan. Providing a recent GPS location can improve scan accuracy and speed, especially near building entrances.
The completion handler to invoke when the scan finishes or encounters an error.
Completion Handler
TheRadarIndoorsScanCompletionHandler is a block type defined as:
A string containing the indoor positioning result. The format depends on the provider implementation but typically includes floor level and coordinates. Returns
nil if the scan fails.The device location when the scan started. This can be used to validate the scan context or for fallback positioning. Returns
nil if location is unavailable.Implementation Example
Here’s a basic implementation structure:Swift Usage
While the protocol is defined in Objective-C, it can be implemented in Swift:Integration with Radar SDK
To use a custom indoor provider with the Radar SDK:Best Practices
Indoor scans can be battery-intensive. Choose scan durations that balance accuracy with battery consumption. Typical scan lengths range from 5-15 seconds.
Scan Duration
- Short scans (5-7 seconds): Faster but less accurate, suitable for frequent updates
- Medium scans (10-12 seconds): Balanced approach for most use cases
- Long scans (15+ seconds): Most accurate but slower and more battery-intensive
Location Context
- Always provide
knownLocationwhen available to improve accuracy - Use the most recent GPS location from outside the building
- The location helps the provider narrow down the search space
Error Handling
Result Format
While the result format is flexible, consider including:- Floor level or building level identifier
- Indoor coordinates (x, y or latitude, longitude)
- Confidence score or accuracy estimate
- Timestamp of the scan
- Provider-specific metadata
Use Cases
- Retail Analytics: Track customer movement through stores and departments
- Venue Navigation: Provide turn-by-turn directions within large buildings
- Workplace Optimization: Monitor space utilization and desk occupancy
- Airport/Transit: Guide travelers through terminals and stations
- Healthcare: Track equipment and personnel in hospitals
See Also
- RadarMotionProtocol - Protocol for motion activity detection
- Indoor Positioning - Complete guide to indoor positioning with Radar