BDLocationManager
Objective-C
@interface BDLocationManager : CLLocationManager
Swift
class BDLocationManager : CLLocationManager
Entry-point for your Application’s interaction with Point SDK.
Point SDK carries out location specific, conditional actions that you define in the Canvas web-interface.
To start these behaviours with your Application, it is necessary only to call the initialize method
on the BDLocationManager.instance
“shared singleton instance” of BDLocationManager
.
Calling the initialization method will start a session with Canvas..
In general, the BDLocationManager.instance
“shared, singleton instance” of BDLocationManager
should be used wherever the standard Core Location
CLLocationManager
class would have been used.
BDLocationManager
is a subclass of CLLocationManager
and is intended as a drop-in replacement while providing additional features.
BDLocationManager
exposes a few new delegate properties, in addition to the usual delegate property
inherited from CLLocationManager:
BDLocationManager.geoTriggeringEventDelegate
- to which you should assign your own implementation of theBDPGeoTriggeringEventDelegate
protocol. The property provides callbacks to notify your application when Zone information is received and any zone enter/ zone exit events as they occur, in real-time.BDLocationManager.tempoTrackingDelegate
- to which you should assign your own implementation of theBDPTempoTrackingDelegate
protocol. This property provides callbacks to notify your application of Tempo related events.BDLocationManager.bluedotServiceDelegate
- to which you should assign your own implementation of theBDPBluedotServiceDelegate
protocol to receive Bluedot service related callbacks (for e.g. location permission changed, accuracy authorization changed, etc.).
By default, BDLocationManager
disables background location updates for While Using location permission, which will not display the visual blue bar in the StatusBar area at the top of the screen and the Point SDK will not process location updates when app is in the background and permission is While Using.
If you prefer to enable that behavior when app is in the background and permission is While Using, set BDLocationManager.backgroundLocationAccessForWhileUsing
to true
.
In addition, some methods of Point SDK classes may only be called while initialized and will otherwise cause an exception to be thrown. Individual restrictions are documented clearly in this API reference. It is only necessary to initialize once during the runtime of the application.
-
Declaration
Objective-C
+ (BDLocationManager *)instance;
Swift
class func instance() -> BDLocationManager!
Return Value
The singleton instance of
BDLocationManager
-
Key-Value Observable representation of the current, underlying CoreLocation authorization status for this Application.
Declaration
Objective-C
@property (nonatomic, readonly) CLAuthorizationStatus authorizationStatus;
Swift
var authorizationStatus: CLAuthorizationStatus { get }
-
Initialize Bluedot Point SDK with projectId.
Note
Bluedot SDK will not start triggering Geofeatures immediately after initialization as per previous API. You will have to make the call explicitly to start/stop Geo-triggering.
Note
Bluedot Point SDK doesn not request for OS location permission on initialization. We encourage you to request OS location permission that you requires (Always or When in Use), at an opportune moment from within your app, to get the best conversion rate. For example, when customer places an order within the mobile app, at this point you can start Geo-triggering, as well as requesting for location permission. To request for OS location permission, you can make the calls via our BDLocationManager Singleton, for example:
[BDLocationManager.instance requestAlwaysAuthorization]; [BDLocationManager.instance requestWhenInUseAuthorization];
Declaration
Objective-C
- (void)initializeWithProjectId:(NSString *_Nonnull)projectId completion: (void (^_Nonnull)(NSError *_Nullable))completion;
Swift
func initialize(withProjectId projectId: String) async throws
Parameters
projectId
The projectId to be initialized. You can find your projectId on Bluedot Canvas
completion
A mandatory completion handler called once processing completed. If the initialization is successful, error will be returned as nil. However, if the initilialization fails, an error will be provided.
-
Method to determine if Point SDK is initialized.
Declaration
Objective-C
- (BOOL)isInitialized;
Swift
func isInitialized() -> Bool
Return Value
Returns whether Bluedot Point SDK is initialized or not
-
Reset Bluedot Point SDK (only if you wish to switch to a different projectId)
Call this method only if you need to switch to a different projectId, this will reset the Bluedot Point SDK to its original state. Upon completion callback, you can make the call
-initializeWithProjectId:completion:
to initialize with a different projectId.Declaration
Objective-C
- (void)resetWithCompletion:(void (^_Nonnull)(NSError *_Nullable))completion;
Swift
func reset() async throws
Parameters
completion
A mandatory completion handler called once processing completed. If the initialization is successful, error will be returned as nil. However, if the initilialization fails, an error will be provided.
-
Implement the callbacks in your own implementation of
BDPTempoTrackingDelegate
, and assign it to this property to receive Tempo related eventsApplications using Point SDK must initialize before using its features. Attempting to call protected features when not initialized will case a
BDPointSessionException
to be thrown.Declaration
Objective-C
@property id<BDPTempoTrackingDelegate> tempoTrackingDelegate;
Swift
var tempoTrackingDelegate: (any BDPTempoTrackingDelegate)! { get set }
-
Implement the callbacks in your own implementation of
BDPBluedotServiceDelegate
, and assign it to this property to receive bluedot service related callbacks (for e.g. location permission changed, accuracy authorization changed, e.t.c.Applications using Point SDK must initialize before using its features. Attempting to call protected features when not initialized will case a
BDPointSessionException
to be thrown.Declaration
Objective-C
@property id<BDPBluedotServiceDelegate> _Nullable bluedotServiceDelegate;
Swift
var bluedotServiceDelegate: (any BDPBluedotServiceDelegate)? { get set }
-
Implement the callbacks in your own implementation of
BDPGeoTriggeringEventDelegate
, and assign it to this property to receive Geotriggering e related callbacks (for e.g. zone updates, fence checkin e.t.c.)Applications using Point SDK must initialize before using its features. Attempting to call protected features when not initialized will case a
BDPointSessionException
to be thrown.Declaration
Objective-C
@property id<BDPGeoTriggeringEventDelegate> _Nullable geoTriggeringEventDelegate;
Swift
var geoTriggeringEventDelegate: (any BDPGeoTriggeringEventDelegate)? { get set }
-
A collection of
BDZoneInfo
objects, corresponding to the Zones you created for this project, in the Canvas web-interface.Declaration
Objective-C
@property (nonatomic, readonly) NSSet<BDZoneInfo *> *zoneInfos;
Swift
var zoneInfos: Set<BDZoneInfo>! { get }
-
Determine whether to allow the SDK to function in the background and when Location permission is While Using.
Set to true to enable the SDK to function (receive location updates) when app is in the background and Location permission is While Using.
Set to false to disable the SDK to function (receiving location updates) when app is in the background and Location permission is While Using.
Default value is false .
Note
This value doesn’t have effect if Location permission is Always.Declaration
Objective-C
@property (nonatomic) BOOL backgroundLocationAccessForWhileUsing;
Swift
var backgroundLocationAccessForWhileUsing: Bool { get set }
-
Disabled or re-enable a specific
BDZoneInfo
“zone”. Information about validBDZoneInfo
“zones”, including their respective zoneId‘s for use in this method, is delivered to-[BDPGeoTriggeringEventDelegate didUpdateZoneInfo]
.Declaration
Objective-C
- (void)setZone:(NSString *)zoneId disableByApplication:(BOOL)disable;
Swift
func setZone(_ zoneId: String!, disableByApplication disable: Bool)
-
Non-blocking method to determine if a user zone is in an enabled state.
Declaration
Objective-C
- (void)applicationContainsDisabledZone:(NSString *)zoneId completion:(void (^)(BOOL))completion;
Swift
func applicationContainsDisabledZone(_ zoneId: String!) async -> Bool
Parameters
zoneId
zone UUID
completion
closure returns whenever zone is disabled or not
-
Returns the installation reference of this Point SDK enabled App. This is the same as the Install Ref that appears in a Zone’s Activity Log in Canvas, or queried via Open API. This reference is randomly generated at the first run-time of the App and remains fixed for the duration of the App installation.
Declaration
Objective-C
- (NSString *)installRef;
Swift
func installRef() -> String!
-
Returns the version of the Point SDK as a NSString.
Declaration
Objective-C
- (NSString *)sdkVersion;
Swift
func sdkVersion() -> String!
-
Sets custom metadata for Notification events. The custom metadata set through this API will be available on the backend in checkin activity log and via webhooks. Only up to 20 custom meta data fields are allowed. Throws
BDCustomEventMetadataCountException
exception if the number of custom fields exceeded. Only String Type is allowed. ThrowsBDCustomEventMetadataDataFormatException
exception if data contains non-String type.Declaration
Objective-C
- (void)setCustomEventMetaData:(NSDictionary *)data;
Swift
func setCustomEventMetaData(_ data: [AnyHashable : Any]!)
-
Returns the custom metadata set by calling setCustomEventMetaData.
Declaration
Objective-C
- (NSDictionary *)customEventMetaData;
Swift
func customEventMetaData() -> [AnyHashable : Any]!
-
Start GeoTriggering features of the Bluedot Point SDK. Please refer to
-[BDLocationManager startGeoTriggeringWithAppRestartNotificationTitle:notificationButtonText:completion:]
if you wish to implement App Restart FeatureNote
You can start Geo-triggering feature only while your App is in the Foreground.Note
An error will be returned if your App does not have either Always or When In Use location permission.Declaration
Objective-C
- (void)startGeoTriggeringWithCompletion: (void (^_Nonnull)(NSError *_Nullable))completion;
Swift
func startGeoTriggering() async throws
Parameters
completion
A mandatory completion handler called once Start GeoTriggering processing completed. If the GeoTriggering feature is started successfully, error will be returned as nil. However, if the Start GeoTriggering feature fails, an error will be provided.
-
Start GeoTriggering features of the Bluedot Point SDK with App Restart feature. Note that Always location permission is required for the App Restart feature.
Note
You can start Geo-triggering feature only while your App is in the Foreground.Note
An error will be returned if your App does not have Always location permission.Note
An error will be returned if notification permission is not granted.Declaration
Objective-C
- (void) startGeoTriggeringWithAppRestartNotificationTitle: (NSString *_Nonnull)notificationTitle notificationButtonText: (NSString *_Nonnull)notificationButtonText completion:(void (^_Nonnull)( NSError *_Nullable)) completion;
Swift
func startGeoTriggering(withAppRestartNotificationTitle notificationTitle: String, notificationButtonText: String) async throws
Parameters
notificationTitle
the string to be used in the title of the banner or alert to be used in the local notification to restart the app.
notificationButtonText
the string to be used in the text of the action button to be used in the local notification to restart the app.
completion
A mandatory completion handler called once Start GeoTriggering processing completed. If the GeoTriggering feature is started successfully, error will be returned as nil. However, if the Start GeoTriggering feature fails, an error will be provided.
-
Method to determine if GeoTriggering is running
Declaration
Objective-C
- (BOOL)isGeoTriggeringRunning;
Swift
func isGeoTriggeringRunning() -> Bool
Return Value
Returns whether GeoTriggering is running
-
Stop GeoTriggering features of the Bluedot Point SDK
Note
Stopping Geo-triggering feature has the intended effect of stopping location services on the device, thereby conserving battery on your user’s device unless another feature such as Tempo, is active.Declaration
Objective-C
- (void)stopGeoTriggeringWithCompletion: (void (^_Nullable)(NSError *_Nullable))completion;
Swift
func stopGeoTriggering() async throws
Parameters
completion
A mandatory completion handler called once Stop Geotriggering processing completed. If the Geotriggering feature is stopped successfully, error will be returned as nil. However, if the Stop Geotriggering fails, an error will be provided.
-
Start Tempo Tracking for destination id provided
Note
An error will be returned if your App does not have Always location permission.Declaration
Objective-C
- (void)startTempoTrackingWithDestinationId:(NSString *_Nonnull)destinationId completion:(void (^_Nonnull)( NSError *_Nullable))completion;
Swift
func startTempoTracking(withDestinationId destinationId: String) async throws
Parameters
destinationId
The destinationId to be tracked
completion
A mandatory completion handler called once Start Tempo processing completed. If the Tempo is started successfully, error will be returned as nil. However, if the Start Tempo fails, an error will be provided.
-
Stop Tempo Tracking
Declaration
Objective-C
- (void)stopTempoTrackingWithCompletion: (void (^_Nonnull)(NSError *_Nullable))completion;
Swift
func stopTempoTracking() async throws
Parameters
completion
A mandatory completion handler called once Stop Tempo processing completed. If the Tempo is stopped successfully, error will be returned as nil. However, if the Stop Tempo fails, an error will be provided.
-
Method to determine if Tempo is running
Declaration
Objective-C
- (BOOL)isTempoRunning;
Swift
func isTempoRunning() -> Bool
Return Value
Returns whether Tempo is running