Configuration

AppSpector uses modules called monitors to track different app activities and gather stats.
We provide a bunch of monitors out of the box which could be used together or in any combinations.
To start AppSpector you need to build instance of AppSpectorConfig and provide your API key.
You can start exact monitors with:

let config = AppSpectorConfig(apiKey: "API_KEY", monitorIDs: [Monitor.logs, Monitor.http])
ASConfig *config = [ASConfig configWithAPIKey:@"API_KEY"
                    monitorIDs:[NSSet setWithObjects:
                                AS_LOG_MONITOR,
                                AS_LOCATION_MONITOR,
                                AS_HTTP_MONITOR, nil]
                   ];

Or start all available with:

let config = AppSpectorConfig(apiKey: "API_KEY")
ASConfig *config = [ASConfig configWithAPIKey:@"API_KEY"];

Available monitors:

Monitor.screenshot
Monitor.sqlite
Monitor.http
Monitor.coredata
Monitor.performance
Monitor.logs
Monitor.location
Monitor.environment
Monitor.notifications
Monitor.analytics
Monitor.userdefaults
Monitor.commands
Monitor.customEvents
Monitor.fileSystem
AS_SCREENSHOT_MONITOR
AS_SQLITE_MONITOR
AS_HTTP_MONITOR
AS_COREDATA_MONITOR
AS_PERFORMANCE_MONITOR
AS_LOG_MONITOR
AS_LOCATION_MONITOR
AS_ENVIRONMENT_MONITOR
AS_NOTIFICATION_MONITOR
AS_ANALYTICS_MONITOR
AS_DEFAULTS_MONITOR
AS_COMMANDS_MONITOR
AS_CUSTOMEVENTS_MONITOR
AS_FS_MONITOR

Then import the framework:

import AppSpectorSDK
@import AppSpectorSDK;

Start selected monitors only:

let config = AppSpectorConfig(apiKey: "API_KEY", monitorIDs: [Monitor.http, Monitor.logs])
AppSpector.run(with: config)
NSSet *monitorIDs = [NSSet setWithObjects:AS_HTTP_MONITOR, AS_LOG_MONITOR, nil];
AppSpectorConfig *config = [AppSpectorConfig configWithAPIKey:@"API_KEY" monitorIDs:monitorIDs];
[AppSpector runWithConfig:config];

or start all monitors:

let config = AppSpectorConfig(apiKey: "API_KEY")
AppSpector.run(with: config)
ASConfig *config = [ASConfig configWithAPIKey:@"API_KEY"];
[AppSpector runWithConfig:config];

To start encrypted session you need to use SDK version with E2EE enabled (see SDK Installation and Configuration ) for details) and provide your app public key alongside with API key:

let config = AppSpectorConfig(apiKey: "API_KEY", publicKey: "PUB_KEY")
AppSpector.run(with: config)
AppSpectorConfig *config = [AppSpectorConfig configWithAPIKey:@"API_KEY" publicKey:@"PUB_KEY"];
[AppSpector runWithConfig:config];

Custom device name

You can assign a custom name to your device to easily find needed sessions in sessions list.
To do this you have to add desired name as a value for AS_DEVICE_NAME_KEY key to the config.metadata dictionary:

let config = AppSpectorConfig(apiKey: "API_KEY", monitorIDs: [Monitor.http, Monitor.logs])
config.metadata = [ DeviceNameKey : "Your device name" ]
AppSpectorConfig *config = [AppSpectorConfig configWithAPIKey:@"API_KEY" monitorIDs:monitorIDs];
config.metadata = @{ AS_DEVICE_NAME_KEY : @"Your device name" };

Start/Stop SDK

AppSpector start is two step process.
When you link with AppSpector framework it starts to collect data immediately after load. When you call startWithConfig method - AppSpector opens a connection to the backend and from that point you can see your session on the frontend.

You can manually control AppSpector state by calling start and stop methods.
stop tells AppSpector to disable all data collection and close current session.
start starts it again using config you provided at load. This will be a new session, all activity between stop and start calls will not be tracked. To check current SDK state you can use + (BOOL)isRunning method.

AppSpector.stop()
AppSpector.start()
[AppSpector stop];
[AppSpector start];