TMD Class Reference
Inherits from | NSObject |
---|---|
Declared in | TMD.h |
Overview
Use this class to initialize the TMD with initWithKey:withEndpoint: as soon as possible in your AppDelegate’s didFinishLaunchingWithOptions method.
+ initWithKey:withEndpoint:withLaunchOptions:
Initialize the Moprim TMD.
+ (TMDTask *)initWithKey:(NSString *)key withEndpoint:(NSString *)endpoint withLaunchOptions:(NSDictionary *_Nullable)launchOptions
Parameters
key |
your API key |
---|---|
endpoint |
your API endpoint |
launchOptions |
the launchOptions you get from your AppDelegate’s didFinishLaunchingWithOptions method. Pass nil if launchOptions is not available. The launchOptions parameter can be used to wake up the TMD when your app is being launched in the background (for example after a significant location change event). |
Discussion
The call to this method should be placed as soon as possible in your AppDelegate’s didFinishLaunchingWithOptions method.
Declared In
TMD.h
+ clearConfig
Prevents further calls to the Cloud API. To be called after signing out a user.
+ (void)clearConfig
Declared In
TMD.h
+ isInitialized
TRUE if the TMD has been properly initialized
+ (BOOL)isInitialized
Return Value
TRUE if the TMD has been properly initialized
Declared In
TMD.h
+ isRunning
TRUE if the TMD service is active and analysing mobility
+ (BOOL)isRunning
Return Value
TRUE if the TMD service is active and analysing mobility
Declared In
TMD.h
+ isIdle
TRUE if the TMD service is active, and no mobility has been detected
+ (BOOL)isIdle
Return Value
TRUE if the TMD service is active, and no mobility has been detected
Declared In
TMD.h
+ isOn
TRUE if the TMD service is active (can be in idle or running state)
+ (BOOL)isOn
Return Value
TRUE if the TMD service is active (can be in idle or running state)
Declared In
TMD.h
+ isOff
TRUE if the TMD service is disabled
+ (BOOL)isOff
Return Value
TRUE if the TMD service is disabled
Declared In
TMD.h
+ getRunningTime
the time in seconds that the TMD has been recording data
+ (NSTimeInterval)getRunningTime
Return Value
the time in seconds that the TMD has been recording data
Declared In
TMD.h
+ getUUID
Get the unique user id associated with this installation
+ (NSString *)getUUID
Declared In
TMD.h
+ setUUID:
Set a unique user id to gather data from multiple installations
+ (void)setUUID:(nullable NSString *)uuid
Parameters
uuid |
the unique user id |
---|
Declared In
TMD.h
+ resetCredentialsWithKey:withEndpoint:
Resets the credentials used for communications with the cloud, and returns a TMDTask object with a new installation Id.
+ (TMDTask *)resetCredentialsWithKey:(NSString *)key withEndpoint:(NSString *)endpoint
Parameters
key |
your API key |
---|---|
endpoint |
your API endpoint |
Discussion
It is recommended to stop the TMD before calling this method.
Declared In
TMD.h
+ getInstallationId
Retrieve the unique application installation id of application using the SDK
+ (TMDTask<NSString*> *)getInstallationId
Return Value
a TMDTask object containing the unique installation id
Declared In
TMD.h
+ getDataInfo
Returns a string containing basic information about the last recorded data. Used for user feedback.
+ (NSString *)getDataInfo
Declared In
TMD.h
+ checkForMissingSensors
Returns an array of string indicating which sensors are missing. See TMDSensors for possible values.
+ (NSArray<NSString*> *)checkForMissingSensors
Declared In
TMD.h
+ start
Starts the TMD service The state of the TMD after this call will be On, and either idle or running.
+ (void)start
Declared In
TMD.h
+ stop
Stops the TMD service The state of the TMD after this call will be Off.
+ (void)stop
Declared In
TMD.h
+ applicationWillTerminate
Use this methods from your AppDelegate’s applicationWillTerminate method in order for the TMD SDK to prepare for the app termination.
+ (void)applicationWillTerminate
Declared In
TMD.h
+ backgroundFetch
Use this methods from your AppDelegate’s performFetchWithCompletionHandler method in order for the TMD SDK to update its data regularly in the background.
+ (TMDTask<NSNumber*> *)backgroundFetch
Return Value
a NSNumber containing an integer representing the UIBackgroundFetchResult rawValue
Discussion
Use the returned value to make a UIBackgroundFetchResult value to pass to the completionHandler. If you have to make your own background fetch as well, it is your responsibility to pass a suitable UIBackgroundFetchResult to the completion handler that would combine your background fetch result with the TMD SDK’s background fetch result.
Declared In
TMD.h
+ application:handleEventsForBackgroundURLSession:completionHandler:
Use this methods from your AppDelegate’s handleEventsForBackgroundURLSession method in order for the TMD SDK to update its data regularly in the background.
+ (void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifier completionHandler:(void ( ^ ) ( void ))completionHandler
Discussion
The identifier provided to this method will be used to check if the Background URL Session belongs to the TMD SDK or not. A call to this method will immediately return if the identifier does not belong to the TMD SDK. If your app is already using the AppDelegate’s handleEventsForBackgroundURLSession method, you must use the identifier to check if the Background URL Session comes from your code.
Declared In
TMD.h
+ setDelegate:
Set an object which adopts the TMDDelegate protocol as a delegate in order to receive events from the TMD.
+ (void)setDelegate:(id<TMDDelegate> _Nullable)delegate
Declared In
TMD.h
+ setUploadDelegate:
Register a TMDUploadDelegate to be notified when an upload starts or ends.
+ (void)setUploadDelegate:(id<TMDUploadDelegate> _Nullable)delegate
Declared In
TMD.h
+ setAllowUploadOnCellularNetwork:
Set to true in order to allow uploads on Mobile Data. By default, uploads on Mobile Data are disabled.
+ (void)setAllowUploadOnCellularNetwork:(bool)allow
Declared In
TMD.h
+ isUploadOnCellularNetworkAllowed
Returns true if the TMD framework is allowed to perform uploads on Mobile Data. Returns false if uploads are only allowed on Wifi.
+ (BOOL)isUploadOnCellularNetworkAllowed
Declared In
TMD.h
+ setAllowAutoFetch:
Set to true in order to allow the TMD framework to fetch new data automatically from the cloud shortly after a data upload. By default, auto fetch is disabled.
+ (void)setAllowAutoFetch:(bool)allow
Declared In
TMD.h
+ isAutoFetchAllowed
Returns true if the TMD framework is allowed to fetch new data automatically from the cloud shortly after a data upload.
+ (BOOL)isAutoFetchAllowed
Declared In
TMD.h