Enabling Activity Monitoring
Activity monitoring is disabled by default and must be explicitly enabled to receive activity updates (walking, driving, cycling, etc.). Follow the steps below to enable activity updates in the SDK.
Step 1: Import the CoreMotion framework.
#import <UIKit/UIKit.h>
#import "FactualEngine.h"
@import CoreMotion;
@interface AppDelegate : UIResponder <UIApplicationDelegate,
...
Step 2: Set the usage description
Set the NSMotionUsageDescription permission in the info.plist (as was done for location permissions).
Permission | info.plist Property |
---|---|
NSMotionUsageDescription | Privacy - Motion Usage Description |
Step 3: Enable monitoring
Adding the following snippet after the SDK is started:
[engine enableActivityMonitoring];
For example, place the above snippet in the engineDidStartWithInstance
callback:
- (void)engineDidStartWithInstance:(FactualEngine *)engine {
NSLog(@"Engine started.");
[engine enableActivityMonitoring];
...
Updated about 3 years ago