Setup & Start Recording

How to setup Smartlook SDK and start recording the application.

To start recording, just put the following code into the application. Once the application runs on a device or in a simulator, recording will appear in the dashboard.

❗️

Some Android simulators are not very reliable when running low-level libraries like Smartlook. Testing on real devices is preferred when debugging an application that utilizes Smartlook.

In order to function properly, the setup should happen as soon as possible in the application life cycle:

import android.application.Application

class MyCustomApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        Smartlook.setupAndStartRecording(API_KEY)
    }
}
import android.application.Application;

public class MyCustomApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        Smartlook.setupAndStartRecording(API_KEY);
    }
}
import Smartlook

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
   Smartlook.setup(key: API_KEY)
   Smartlook.startRecording()
}
#import <Smartlook/Smartlook.h>
 
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  SLSetupConfiguration *slConfig = [[SLSetupConfiguration alloc] initWithKey:@"API_KEY"];
  [Smartlook setupAndStartRecordingWithConfiguration:slConfig];
  // other initialization stuff
  return YES;
}
class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    final SetupOptions options = SetupOptionsBuilder('API_KEY').build();
    Smartlook.setupAndStartRecording(options);
  }
}
import Smartlook from 'smartlook-react-native-wrapper';

Smartlook.setupAndStartRecording(API_KEY);
import { Smartlook, SmartlookSetupConfig } from '@ionic-native/smartlook/ngx';

export class AppComponent {
  constructor(public platform: Platform, public smartlook: Smartlook) {
    this.platform.ready().then(() => {
      this.smartlook.setupAndStartRecording(
        new SmartlookSetupConfig(API_KEY)
      );
    });
  }
}
if(document.readyState === "complete") {
  document.addEventListener("deviceready", onDeviceReady, false);
}

function onDeviceReady() {
    Smartlook.setupAndStartRecording({smartlookAPIKey: API_KEY});
}
public class NewBehaviourScript : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        SmartlookUnity.SetupOptionsBuilder builder = new SmartlookUnity.SetupOptionsBuilder("API_KEY");
        SmartlookUnity.Smartlook.SetupAndStartRecording(builder.Build());
    }

    // Update is called once per frame
    void Update()
    {
        ...
    }
}
using Smartlook;
...
Smartlook.Analytics.SetupAndStart(API_KEY);

This is basically all that is needed to record the sessions. All other events in the application life cycle are handled by Smartlook automatically.

📘

When is the recording visible in dashboard?

It may take several minutes before the recordings appear in the Dashboard. In the default setup, recordings are not uploaded when the device is on a mobile network. For the recordings being available immediately, the device must be on Wi-Fi, or mobile uploads must be enabled in the project dashboard.

The recording is not streamed, it is uploaded in chunks and then processed on the server. An in-depth description when the recordings will be available in the project dashboard will provide this document.

🚧

iOS: Main Thread Checker warning

When debugging an iOS application with Smartlook, a Main Thread Checker warning which might be accompanied by a short application freeze during the application start is encountered. The freeze does not happen in production builds. Details of how to solve this situation provides this technical note.

Setup Options

Smartlook recording can be customized by several parameters. Some of the recording customization options can be set by dedicated methods, some others can also be set as startup options.

🚧

Not all options are available on all platforms. For a comprehensive list of all the setup options and related details, consult our API reference .