Android: Setup outside Application class


This guide is focused on Android (Kotlin/Java).

Sometimes it is not possible to initialize SDK at the start of the application. A typical example is when you need to fetch your api key so you don't have your api key at the application start.

If this is the case you will need to provide the SDK setup with an actual Activity reference so the SDK can “catch up” with the application’s lifecycle.

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle) {

        val options = Smartlook.SetupOptionsBuilder(YOUR_API_KEY)

public class MainActivity extends AppCompatActivity {

    protected void onCreate(Bundle savedInstanceState) {

        Smartlook.SetupOptionsBuilder builder = new Smartlook.SetupOptionsBuilder(YOUR_API_KEY)