Install the SDK

To use this plugin, run this command:

$ flutter pub add flight_recorder

Alternatively, add flight_recorder as a dependency in your pubspec.yaml file.

Android Project Updates

Make the following updates to your android project:

Update MainActivity to extend FlutterFragmentActivity

In order for the screen recording to work, the MainActivity needs to extend FlutterFragmentActivity rather than FlutterActivity. Update the code as follows:

  1. Open your Flutter app in your coding editor.

  2. Open the file at ./android/app/src/main/kotlin/{your app path}/MainActivity.kt.

  3. Replace the line import io.flutter.embedding.android.FlutterActivitywith import io.flutter.embedding.android.FlutterFragmentActivity.

    MainActivity.kt
    
    import io.flutter.embedding.android.FlutterFragmentActivity // ← Update
    
    class MainActivity: FlutterActivity() {  
    
    // ...
  4. Replace class MainActivity: FlutterActivity() { with class MainActivity: FlutterFragmentActivity() .

    MainActivity.kt
    
    import io.flutter.embedding.android.FlutterFragmentActivity
    
    class MainActivity: FlutterFragmentActivity() {  // ← Update
    
    // ...

Update the minSdkVersion and compileSdkVersion

flight_recorder is compatible only from version 21 of Android SDK, the required compileSdkVersion is 34. Update these settings as follows:

  1. Open the file at ./android/app/build.gradle.

  2. Locate the android section, and inside there, the defaultConfig section.

  3. Replace the line minSdkVersion flutter.minSdkVersion with minSdkVersion 21, as per the following code snippet:

    build.gradle
    // ...
    android {
        // ...
        default {
            // ...
            minSdkVersion 21  // ← Update the minSdkVersion
            targetSdkVersion flutter.targetSdkVersion
            // ...
  4. Insert the line compileSdkVersion 34 underneath minSdkVersion 21 as follows:

    build.gradle
    // ...
    android {
        // ...
        default {
            // ...
            minSdkVersion 21
            compileSdkVersion 34 // ← Insert the compileSdkVersion
            targetSdkVersion flutter.targetSdkVersion 
            // ...

iOS Project Updates

  1. Open the Xcode workspace in your project by opening ios/Runner.xcworkspace.

  2. Select the project in the Project Navigator (A). Select your app's main target inside the TARGETS section (B), then click on the General tab (C) to open the general build settings for this target.

  3. Verify that the version in Minimum Deployments is 15.0 or higher. If the version is lower than 15.0, update the minimum deployment to 15.0 or higher. If you wish to continue supporting users on devices running iOS lower than 15.0, contact us at flightrecorder@pulselabs.ai. NB: 14.x is now end of life, and users of these devices will no longer receive security updates from Apple.

  4. Open ios/Flutter/AppframeworkInfo.plist and update the MinimumOSVersion value to match the version you selected.

Last updated