TMD Class Reference
| Inherits from | NSObject |
|---|---|
| Conforms to | TMDUserApiDelegate |
| 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.
+ sharedInstance
This is only useful if you need a reference to the TMD (in most cases, you won’t, as all the methods exposed here are class methods)
+ (TMD *)sharedInstanceDeclared In
TMD.h
+ initWithKey:withEndpoint:withLaunchOptions:
Initialize the Moprim TMD.
+ (TMDTask *)initWithKey:(NSString *)key withEndpoint:(NSString *)endpoint withLaunchOptions:(NSDictionary *_Nullable)launchOptionsParameters
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)clearConfigDeclared In
TMD.h
+ isInitialized
TRUE if the TMD has been properly initialized
+ (BOOL)isInitializedReturn 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)isRunningReturn 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)isIdleReturn 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)isOnReturn 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)isOffReturn 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)getRunningTimeReturn 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 *)getUUIDDeclared In
TMD.h
+ setUUID:
Set a unique user id to gather data from multiple installations
+ (void)setUUID:(nullable NSString *)uuidParameters
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 *)endpointParameters
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*> *)getInstallationIdReturn 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 *)getDataInfoDeclared In
TMD.h
+ checkForMissingSensors
Returns an array of string indicating which sensors are missing. See TMDSensors for possible values.
+ (NSArray<NSString*> *)checkForMissingSensorsDeclared 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)startDeclared In
TMD.h
+ stop
Stops the TMD service The state of the TMD after this call will be Off.
+ (void)stopDeclared 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)applicationWillTerminateDeclared 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*> *)backgroundFetchReturn 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 ))completionHandlerDiscussion
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)delegateDeclared In
TMD.h
+ setUploadDelegate:
Register a TMDUploadDelegate to be notified when an upload starts or ends.
+ (void)setUploadDelegate:(id<TMDUploadDelegate> _Nullable)delegateDeclared 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)allowDeclared 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)isUploadOnCellularNetworkAllowedDeclared 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)allowDeclared 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)isAutoFetchAllowedDeclared In
TMD.h
+ numberOfFilesLeftToUpload
Returns the number of data files that are not uploaded yet.
+ (int)numberOfFilesLeftToUploadDeclared In
TMD.h
+ lastDataFileCreationDate
Returns the date of the last file that has been created and that is still on the phone, or nil if no file is present.
+ (nullable NSDate *)lastDataFileCreationDateDeclared In
TMD.h
+ oldestDataFileCreationDate
Returns the date of the oldest file that has been created and that is still on the phone, or nil if no file is present.
+ (nullable NSDate *)oldestDataFileCreationDateDeclared In
TMD.h