Show the Introduction Screen

The SDK displays the introduction screen during the very first app launch, considering this the trigger. This feature enables you to add extra triggers and also allows you to disable the default app launch trigger.

For instance, you may choose to present the introduction screen at the end of your onboarding screens or provide an option to show it again from a help menu.

Select a Trigger and Show the Introduction Screen

  1. Decide from where you want to show the introduction screen. For example, at the end of your onboarding screens or when a button in a menu is pressed. We will call this the trigger. This very simple example shows a possible trigger - when onButtonClick is called inside a Jetpack Compose app.

    Kotlin
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
    
        val flightRecorder = FlightRecorderSdk(
            this, 
            lifecycle, 
            this, 
            apiKey = "API_KEY"
        )
    
        setContent {
            AppTheme {
                Surface() {
                    MyScreen(onButtonClick = { 
                        // This will be the trigger
                    })
                }
            }
        }
    }
  2. Make sure you are capturing a reference to the output of FlightRecorderSdk when you initialize the SDK:

    Kotlin
    val flightRecorder = 
        FlightRecorderSdk(
            this,
            lifecycle,
            this, 
            apiKey = "API_KEY"
        )

    Java
    var flightRecorder = 
          this,
          getLifecycle(), 
          this, 
          "YOUR_API_KEY", 
          true, 
          false
       );
  3. Choose an approach to access the flightRecorder variable from the trigger in your code. You could choose create a class to hold flightRecorder and access it statically.

  4. Call showIntroductionScreen at the moment you want to show the introduction screen inside the trigger.

    Kotlin
    flightRecorder.showIntroductionScreen()

    Java
    flightRecorder.showIntroductionScreen();

    In our Kotlin Jetpack Compose example, we call the method from the onButtonClick function:

    Kotlin
        setContent {
            AppTheme {
                Surface() {
                    MyScreen(onButtonClick = { 
                        flightRecorder.showIntroductionScreen() 
                    })
                }
            }
        }

Prevent the Introduction Screen from Showing on First Launch

If you do not wish to show the introduction screen when you first launch the app, follow the instructions below for your apps language.

Kotlin

Set automaticallyShowIntroduction = false when creating the FlightRecorderSdk object.

Kotlin
val flightRecorder = FlightRecorderSdk(
    this,
    lifecycle,
    this, 
    apiKey = "API_KEY",
    automaticallyShowIntroduction = false
)

Java

Update the FlightRecorderSdk object declaration to the below, setting the fifth parameter to false:

Java
var flightRecorder = new FlightRecorderSdk(
    this, 
    getLifecycle(), 
    this, 
    "YOUR_API_KEY", 
    false, 
    false);

Last updated