Android Singleton Reset
    • 1 Minute to read
    • Dark
      Light

    Android Singleton Reset

    • Dark
      Light

    Article summary

    The reset function reinitializes the Mapp Intelligence Singleton to its default values. It performs the following actions:

    • Deletes the current Ever ID (eid), which is used to identify the user.

    • Deletes the Track ID.

    • Deletes the Track Domain.

    • Resets the user by setting one internal parameter to 0.

    • Opens a new session by resetting the fns parameter to 1.

    Key Points

    • For SDK versions 5.1.3 and lower, after calling the reset function, you must set a new configuration.

    • For SDK version 5.1.4 and higher, the Android SDK automatically re-initializes the Singleton using the configuration specified in your application class. Therefore, you don’t need to manually reset the configuration.

    This method is designed to help with debugging and testing during the SDK implementation. Do not use it in production environments, as it may lead to unexpected behavior or errors.

    Method

    Kotlin

    // Reset Singleton in Kotlin
    Webtrekk.reset(this)

    Java

    Webtrekk.reset(Context)

    Example

    Webtrekk.reset(this)
    
    //DEPRECATED AS OF VERSION 5.1.4
    val trackIds= "...LIST OF TRACK_IDS"
    val domain = "...DOMAIN ADRESS"
    
    val config=WebtrekkConfiguration.Builder(trackIds, domain)
        .setBatchSupport(batchEnabled) // optional but recommended 
        .build()
    
    Webtrekk.reset(this,config)button1.setOnClickListener {
                Webtrekk.reset(this)
            }
    Webtrekk.reset(this);
    
    //DEPRECATED AS OF VERSION 5.1.4
    List<String> trackIds= "...LIST OF TRACK_IDS";
    String domain="...DOMAIN ADRESS";
    
    Config config= new WebtrekkConfiguration.Builder(trackIds,domain)
            .setBatchSupport(true) // optional but recommended
            .build();
    
    Webtrekk.reset(this,config);


    Was this article helpful?