Alohar Class Reference
Inherits from | NSObject |
Declared in | Alohar.h Alohar.m |
Overview
Alohar is the main interface to Alohar’s framework.
To use the Alohar, user needs to authenticate first. For a new user, call registerWithAppID:andAPIKey:withDelegate or call authenticateWithAppID:andAPIKey:andUserID:withDelegate
Once the user is authenticated, he/she can start to use rest of
framework. Alohar is a persistent sensing framework, to enable the
persistent sensing, user shall start the service by calling
startMonitoringUser
The service can be stopped any time by calling
stopMonitoringUser
Tasks
-
+ sharedInstance
Get the Shared Instance of Alohar
-
+ version
Get Framework Version
-
+ registerWithAppID:andAPIKey:withDelegate:
Register a new user for a given App
-
+ authenticateWithAppID:andAPIKey:andUserID:withDelegate:
Authenticate an existing user. For new user, please use registerWithAppID:andAPIKey:withDelegate instead.
-
+ currentUserStay
Get the current user stay object
-
+ getUserStaysForDate:withDelegate:
Get the user’s user stays for a given date.
-
+ getUserStaysFromDate:toDate:withDelegate:
Get the user’s user stays within a time period
-
+ getUserStaysFromDate:toDate:atLocation:radius:limit:includeCandidiates:withDelegate:
Get user’s user stays within a time period and a location boundary.
-
+ getAllPlacesWithDelegate:
Get all places a user visited.
-
+ getPlaces:withDelegate:
Get places user visited and match the given name
-
+ getPlaces:withCategory:withDelegate:
Get places user visited match the given name and category
-
+ getPlaces:fromDate:toDate:minimalVisits:withCategory:limit:withDelegate:
Get places the user visited within a time window that match the category regex.
-
+ getPlaceCandidatesForStay:withDelegate:
Get the place candidates of a user stay.
-
+ getStaysForPlace:withDelegate:
Get all user stays of a place.
-
+ getDetailsForPlace:withDelegate:
Get details for a place.
-
+ getDetailsForStay:withDelegate:
Get details for a user stay.
-
+ currentLocation
Get the user’s current location.
-
+ currentMotionState
Get the device’s current motion state.
-
+ isStationary
Check whether the device is stationary.
-
+ isBetweenUserStays
Check whether the user is in between user stays.
-
+ monitoringUser
- Check whether the Alohar monitoring service is running.
-
+ isLoggedIn
Check whether the user has valid credentials and has an active session.
-
+ userStayLocationHistory
History of arrival/departure events.
Class Methods
authenticateWithAppID:andAPIKey:andUserID:withDelegate:
Authenticate an existing user. For new user, please use registerWithAppID:andAPIKey:withDelegate instead.
+ (void)authenticateWithAppID:(NSString *)appID andAPIKey:(NSString *)APIKey andUserID:(NSString *)userID withDelegate:(id<ALSessionDelegate>)delegate
Parameters
- appID
The AppID assigned for the App.
- APIKey
The ApiKey assigned to the App.
- userID
The unique user ID assigned from Alohar from registration.
- delegate
A delegate that conforms to the ALSessionDelegate protocol.
Discussion
Authenticate an existing user. For new user, please use registerWithAppID:andAPIKey:withDelegate instead.
Declared In
Alohar.h
currentLocation
Get the user’s current location.
+ (CLLocation *)currentLocation
Discussion
Get the user’s current location.
Declared In
Alohar.h
currentMotionState
Get the device’s current motion state.
+ (ALMotionState *)currentMotionState
Discussion
Get the device’s current motion state.
See Also
Declared In
Alohar.h
currentUserStay
Get the current user stay object
+ (ALUserStay *)currentUserStay
Discussion
Get the current user stay object
See Also
Declared In
Alohar.h
getAllPlacesWithDelegate:
Get all places a user visited.
+ (void)getAllPlacesWithDelegate:(id<ALRequestDelegate>)delegate
Parameters
- delegate
A delegate that comforms to the ALRequestDelegate protocol.
NOTE The response might be large depends on the total number of the places user visisted. Recommend to use getPlaces:withCategory:withDelegate instead.
Discussion
Get all places a user visited.
Declared In
Alohar.h
getDetailsForPlace:withDelegate:
Get details for a place.
+ (void)getDetailsForPlace:(ALPlace *)place withDelegate:(id<ALRequestDelegate>)delegate
Discussion
Get details for a place.
Declared In
Alohar.h
getDetailsForStay:withDelegate:
Get details for a user stay.
+ (void)getDetailsForStay:(ALUserStay *)stay withDelegate:(id<ALRequestDelegate>)delegate
Parameters
- stay
Valid user stay.
- delegate
A delegate that comforms to the ALRequestDelegate protocol.
Discussion
Get details for a user stay.
Declared In
Alohar.h
getPlaceCandidatesForStay:withDelegate:
Get the place candidates of a user stay.
+ (void)getPlaceCandidatesForStay:(ALUserStay *)stay withDelegate:(id<ALRequestDelegate>)delegate
Parameters
- stay
A user stay. @see ALUserStay
- delegate
A delegate that comforms to the ALRequestDelegate protocol.
Discussion
Get the place candidates of a user stay.
Declared In
Alohar.h
getPlaces:fromDate:toDate:minimalVisits:withCategory:limit:withDelegate:
Get places the user visited within a time window that match the category regex.
+ (void)getPlaces:(NSString *)namePattern fromDate:(NSDate *)startDate toDate:(NSDate *)endDate minimalVisits:(NSInteger)visits withCategory:(NSString *)catPattern limit:(NSInteger)limit withDelegate:(id<ALRequestDelegate>)delegate
Parameters
- namePattern
The regular expression for the place name
- startDate
The start time
- endDate
The end Time
- visits
The mininal numer of visits required for that places. Optioanl. The default is 1.
- catPattern
The regular expression to match the place’s category
- limit
The limitation of total number matches to return. Optional. The default is 500.
- delegate
A delegate that comforms to the ALRequestDelegate protocol.
Discussion
Get places the user visited within a time window that match the category regex.
Declared In
Alohar.h
getPlaces:withCategory:withDelegate:
Get places user visited match the given name and category
+ (void)getPlaces:(NSString *)namePattern withCategory:(NSString *)catPattern withDelegate:(id<ALRequestDelegate>)delegate
Parameters
- namePattern
The regular expression to match the place name
- catPattern
The regular expression to match the place’s category
- delegate
A delegate that comforms to the ALRequestDelegate protocol.
Discussion
Get places user visited match the given name and category
Declared In
Alohar.h
getPlaces:withDelegate:
Get places user visited and match the given name
+ (void)getPlaces:(NSString *)namePattern withDelegate:(id<ALRequestDelegate>)delegate
Parameters
- namePattern
The regular expression to match the place name.
- delegate
A delegate that comforms to the ALRequestDelegate protocol.
Discussion
Get places user visited and match the given name
Declared In
Alohar.h
getStaysForPlace:withDelegate:
Get all user stays of a place.
+ (void)getStaysForPlace:(ALPlace *)place withDelegate:(id<ALRequestDelegate>)delegate
Parameters
- place
A place. @see ALPlace
- delegate
A delegate that comforms to the ALRequestDelegate protocol.
Discussion
Get all user stays of a place.
Declared In
Alohar.h
getUserStaysForDate:withDelegate:
Get the user’s user stays for a given date.
+ (void)getUserStaysForDate:(NSDate *)date withDelegate:(id<ALRequestDelegate>)delegate
Parameters
- date
The date to search user stay.
- delegate
A delegate that comforms to the ALRequestDelegate protocol.
Discussion
Get the user’s user stays for a given date.
Declared In
Alohar.h
getUserStaysFromDate:toDate:atLocation:radius:limit:includeCandidiates:withDelegate:
Get user’s user stays within a time period and a location boundary.
+ (void)getUserStaysFromDate:(NSDate *)startDate toDate:(NSDate *)endDate atLocation:(CLLocation *)location radius:(NSInteger)radius limit:(NSInteger)limit includeCandidiates:(BOOL)includeCand withDelegate:(id<ALRequestDelegate>)delegate
Parameters
- startDate
The start time
- endDate
The end time
- location
The centroid location of the search area. Optional.
- radius
The search radius in meter. Optinal. Skip if the location is not provided.
- limit
The limitation of total number matches to return. Optional. The default is 500.
- includeCand
Flag to indicate whether the user stay shall include its candidates. Optional. The default is NO.
- delegate
A delegate that comforms to the ALRequestDelegate protocol.
Discussion
Get user’s user stays within a time period and a location boundary.
Declared In
Alohar.h
getUserStaysFromDate:toDate:withDelegate:
Get the user’s user stays within a time period
+ (void)getUserStaysFromDate:(NSDate *)startDate toDate:(NSDate *)endDate withDelegate:(id<ALRequestDelegate>)delegate
Parameters
- startDate
The start time.
- endDate
The end time.
- delegate
A delegate that comforms to the ALRequestDelegate protocol.
Discussion
Get the user’s user stays within a time period
Declared In
Alohar.h
isBetweenUserStays
Check whether the user is in between user stays.
+ (BOOL)isBetweenUserStays
Return Value
YES if the user has left their previous stay, but has not arrived at a new place.
Discussion
Check whether the user is in between user stays.
Declared In
Alohar.h
isLoggedIn
Check whether the user has valid credentials and has an active session.
+ (BOOL)isLoggedIn
Return Value
YES if the user connected to Alohar
Discussion
Check whether the user has valid credentials and has an active session.
Declared In
Alohar.h
isStationary
Check whether the device is stationary.
+ (BOOL)isStationary
Return Value
YES if the device is NOT moving
Discussion
Check whether the device is stationary.
Declared In
Alohar.h
monitoringUser
- Check whether the Alohar monitoring service is running.
+ (BOOL)monitoringUser
Return Value
YES if the monitoring service is ON
Discussion
- Check whether the Alohar monitoring service is running.
Declared In
Alohar.h
registerWithAppID:andAPIKey:withDelegate:
Register a new user for a given App
+ (void)registerWithAppID:(NSString *)appID andAPIKey:(NSString *)APIKey withDelegate:(id<ALSessionDelegate>)delegate
Parameters
- appID
The AppID assigned for the App, click https://www.alohar.com/developer to register your app.
- APIKey
The ApiKey assigned for the App
- delegate
A delegate comform to ALSessionDelegate
Discussion
Register a new user for a given App
Declared In
Alohar.h
sharedInstance
Get the Shared Instance of Alohar
+ (Alohar *)sharedInstance
Discussion
Get the Shared Instance of Alohar
Declared In
Alohar.h
userStayLocationHistory
History of arrival/departure events.
+ (NSArray *)userStayLocationHistory
Return Value
Array of events
Note: There are three type of events: Arrival, Departure, UserStay For Arrival/Departure events, the NSDictionary has the following key/value pairs: {type:(NSString), location:(CLLocation), timestamp:(NSInteger)}
For Userstay events, the NSDictionary has the following key/value pairs: {type:(NSString), stay:(ALUserStay), timestamp:(NSInteger)}
Discussion
History of arrival/departure events.
Declared In
Alohar.h