iOS – Programming a minimal Point SDK app
BDLocationManager is the entry-point for an app to start using Point SDK.
Point SDK acts upon rules that are defined via the Canvas web-interface. To enable these within an application, it is necessary to call the authentication method on the shared instance of BDLocationManager. A Project ID is used as the parameter.
Calling the authentication method will start a session with Canvas. However, it’s not required to call this method after app restart unless the user has been logged out. Initialising an SDK in AppDelegate make the enhanced restart mode work correctly.
Zones will be downloaded, and associated Actions will be executed by the library without any further intervention. In general, the singleton instance of BDLocationManager should be used wherever the standard Core Location CLLocationManager class would otherwise be used.
BDLocationManager exposes properties for two delegates, in addition to the standard
delegate property inherited from CLLocationManager:
The most notable of these additional features are:
- Session Delegate – the BDPSessionDelegate protocol provides callbacks informing the application when Point SDK’s authentication state changes. The rules defined in Canvas will only be observed while authenticated. Also, some methods of Point SDK classes may just be called while the application is in the authenticated state and will otherwise cause an exception to be thrown. Such restrictions are documented clearly in this API reference. It is only necessary to authenticate once during the runtime of the application.
- Location Delegate – following the delegate pattern familiar throughout Apple’s Cocoa Touch frameworks, the
locationDelegateproperty of BDLocationManager provides callbacks to notify an application when:
a. zone information is received. This typically occurs immediately after the authentication process completes.
b. Any Zones defined in Canvas are triggered, in real-time.
Either of two call-backs will be made, depending on whether a check-in was triggered by the device entering a Geofence.
c. Following (b), if the willCheckOut flag was set to true, either of the following corresponding call-backs will also be made when the device leaves the checked-in area: