Inherits from NSObject
Conforms to CLLocationManagerDelegate
RPKAccuracyManagerDelegate
Declared in RPKManager.h

Overview

RPKManager

This is the main class for used for interacting with the Proximity Kit SDK.

More information can be found at http://proximitykit.com

Properties

delegate

delegate

@property (assign) id<RPKManagerDelegate> delegate

Discussion

delegate

Primary delegate for the RPKManager.

Declared In

RPKManager.h

kit

kit

@property (readonly) RPKKit *kit

Discussion

kit

The representation of the Kit as defined in the Proximity Kit service. This contains lists of iBeacons and Geofences.

Declared In

RPKManager.h

locationManager

locationManager

@property (readonly) CLLocationManager *locationManager

Discussion

locationManager

The instance of CLLocation manager that RPKManager wraps and maintains.

Declared In

RPKManager.h

locationManagerDelegate

locationManagerDelegate

@property (assign) id<CLLocationManagerDelegate> locationManagerDelegate

Discussion

locationManagerDelegate

Proxy for all of the CLLocationManager delgate methods. All of the non-deprecated methods from CLLocationManagerDelegate will be called on this object.

This is useful for accessing the underlying core location functionality while using the same locationManager instance that Proximity Kit wraps and maintains.

Declared In

RPKManager.h

Class Methods

getVersion

getVersion

+ (NSString *)getVersion

Discussion

getVersion

Get the version string for the Proximity Kit Framework

Declared In

RPKManager.h

manager

manager

+ (RPKManager *)manager

Discussion

manager

Creates the manager without a delegate.

Declared In

RPKManager.h

managerWithConfig:

managerWithConfig

+ (RPKManager *)managerWithConfig:(NSDictionary *)config

Discussion

managerWithConfig

Creates the manager without a delegate and uses the supplied configuration dictionary instead of loading the configuration from the plist file.

Configuration Options:

- [kit](#//api/name/kit)_url: NSString with the PK [kit](#//api/name/kit) URL
- api_token: PK API Token
- allow_cellular_data: Allow cellular data usage
- monitor_closest_beacon: Provide a callback event when the closest beacon changes
- averaging_seconds: Time period (in seconds) to average accuracy measurements over (optional)

Declared In

RPKManager.h

managerWithDelegate:

managerWithDelegate

+ (RPKManager *)managerWithDelegate:(id<RPKManagerDelegate>)delegate

Discussion

managerWithDelegate

Creates the manager, assignes the delegate.

Declared In

RPKManager.h

managerWithDelegate:andConfig:

managerWithDelegate:andConfig

+ (RPKManager *)managerWithDelegate:(id<RPKManagerDelegate>)delegate andConfig:(NSDictionary *)config

Discussion

managerWithDelegate:andConfig

Creates the manager, assignes the delegate, and uses the supplied configuration dictionary instead of loading the configuration from the plist file.

Declared In

RPKManager.h

Instance Methods

getRegionForIdentifier:

getRegionForIdentifier

- (RPKRegion *)getRegionForIdentifier:(NSString *)identifier

Discussion

getRegionForIdentifier

Lookup the RPKRegion for a given identifier.

Returns nil if no region found.

Declared In

RPKManager.h

logLevel:

logLevel Set the logging level. Follows syslog convention of levels 0-7.

- (void)logLevel:(NSInteger)level

Discussion

logLevel Set the logging level. Follows syslog convention of levels 0-7.

See RPKLogger.h for more details

Param: logLevel

Can take an integer value between 0 and 7, to represent the log level.

0 - Emergency: System is unusable
1 - Alert: Action must be taken immediately
2 - Critical: Critical conditions
3 - Error: Error conditions
4 - Warning: Warning conditions
5 - Notice: Normal but significant condition
6 - Informational: Informational messages
7 - Debug: Debug-level messages

Declared In

RPKManager.h

setAirship:

setAirship

- (void)setAirship:(id)airship

Discussion

setAirship

Sets the shared instance of Urban Airship SDK instance.

Param: airship the instance of UAirship manager

[pkManager setAirship: [UAirship shared]];

Declared In

RPKManager.h

setPartnerIdentifier:

setPartnerIdentifier

- (void)setPartnerIdentifier:(NSString *)identifier

Discussion

setPartnerIdentifier

Sets the partner identifer string for analytics.

Limited to 255 characters.

Declared In

RPKManager.h

start

start

- (void)start

Discussion

start

Sets up the manager and synchronizes data with the server.

Declared In

RPKManager.h

startRangingBeacons

startRangingIBeacons

- (void)startRangingBeacons

Discussion

startRangingIBeacons

Start calculating ranges for iBeacons.

Declared In

RPKManager.h

stop

stop

- (void)stop

Discussion

stop

Unregister regions and beacons and stop automatic syncing.

While the RPKManager is stopped if sync is called the api will be called and data downloaded and synced. However, any regions will not be registered with CoreLocation.

Declared In

RPKManager.h

stopRangingIBeacons

stopRangingIBeacons

- (void)stopRangingIBeacons

Discussion

stopRangingIBeacons

Stop calculating ranges for iBeacons.

Declared In

RPKManager.h

sync

sync

- (void)sync

Discussion

sync

Force a sync with the server. This is not normally required.

Declared In

RPKManager.h

syncWithCompletionHandler:

syncWithCompletionHandler

- (void)syncWithCompletionHandler:(void ( ^ ) ( UIBackgroundFetchResult ))completionHandler

Discussion

syncWithCompletionHandler

Same as sync, but accepts a block for the sync callbacks. This is particularly useful for updating the ProximityKit data when the application in in the background.

To take advantage of this you need to implement application:performFetchWithCompletionHandler: on your in your application delegate. Then Within that method you can simply call syncWithCompletionHandler and pass it the compleation block:

- (void) application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
// ...
[pkManager syncWithCompletionHandler: completionHandler];
}

Be sure to set the fetch interval in your didFinishLaunching method:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// ...
[application setMinimumBackgroundFetchInterval:UIApplicationBackgroundFetchIntervalMinimum];
return YES;
}

Finally make sure you add UIBackgroundModes to your info plist with a string set to ‘fetch’

Declared In

RPKManager.h