### Complete Android SDK Integration Example (Kotlin) Source: https://context7.com/refiner-io/mobile-sdk-android/llms.txt Demonstrates a full integration of the Refiner SDK in an Android Activity, including user identification, contextual data attachment, screen tracking, event tracking, and survey completion callbacks. This example requires the Refiner SDK to be initialized elsewhere in the application. ```kotlin import android.os.Bundle import android.util.Log import androidx.appcompat.app.AppCompatActivity import io.refiner.Refiner class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) // Identify the logged-in user try { Refiner.identifyUser( userId = "user-12345", userTraits = linkedMapOf( Pair("email", "user@example.com"), Pair("plan", "premium"), Pair("signup_date", "2024-01-15") ), locale = "en", signature = null, writeOperation = Refiner.WriteOperation.APPEND ) } catch (e: Exception) { Log.e("Refiner", "Identification failed: ${e.message}") } // Attach contextual data for this screen Refiner.addToResponse( contextualData = hashMapOf( Pair("screen", "main_dashboard"), Pair("feature_flags", "new_ui,beta_export") ) ) // Track screen view Refiner.trackScreen(screenName = "main_dashboard") // Check for any scheduled surveys Refiner.ping() // Register completion callback for navigation Refiner.onComplete { formId, formData -> Log.i("Refiner", "User completed survey $formId") // Navigate to next screen or show thank you message } } private fun onPurchaseCompleted() { // Track purchase event Refiner.trackEvent(eventName = "purchase_completed") // Trigger post-purchase CSAT survey Refiner.showForm(formUuid = "csat-form-uuid") } override fun onDestroy() { super.onDestroy() // User logging out Refiner.resetUser() } } ``` -------------------------------- ### Start New User Session (Kotlin) Source: https://github.com/refiner-io/mobile-sdk-android/blob/main/README.md Manually initiate a new user session. This is useful for tracking user engagement immediately after they open the application, complementing the automatic session detection after an hour of inactivity. ```kotlin Refiner.startSession() ``` -------------------------------- ### Start New Session (Android Kotlin) Source: https://context7.com/refiner-io/mobile-sdk-android/llms.txt Manually start a new user session. The SDK automatically detects new sessions after 1 hour of inactivity, but this function allows for explicit session initiation. ```kotlin import io.refiner.Refiner // Start new session when app opens Refiner.startSession() ``` -------------------------------- ### Track Screen Views (Kotlin) Source: https://context7.com/refiner-io/mobile-sdk-android/llms.txt Track screen views to enable launching surveys in specific sections of your application. Call this method whenever a user navigates to a new screen. Examples include 'checkout_screen', 'profile_settings', and 'product_details'. ```kotlin import io.refiner.Refiner // Track screen when user navigates Refiner.trackScreen(screenName = "checkout_screen") Refiner.trackScreen(screenName = "profile_settings") Refiner.trackScreen(screenName = "product_details") ``` -------------------------------- ### Track User Events (Kotlin) Source: https://context7.com/refiner-io/mobile-sdk-android/llms.txt Track specific user actions or events within the application. This data can be used to create segments and target audiences based on user behavior. Examples include 'purchase_completed', 'exported_report', and 'completed_onboarding_step_3'. ```kotlin import io.refiner.Refiner // Track purchase completion Refiner.trackEvent(eventName = "purchase_completed") // Track feature usage Refiner.trackEvent(eventName = "exported_report") // Track onboarding progress Refiner.trackEvent(eventName = "completed_onboarding_step_3") ``` -------------------------------- ### Initialize Refiner SDK (Kotlin) Source: https://context7.com/refiner-io/mobile-sdk-android/llms.txt Initialize the Refiner SDK in your Application class's `onCreate()` method. This is a prerequisite for using any other SDK functionalities. The `projectId` is essential and can be obtained from your Refiner dashboard. Debug mode can be enabled for development logging. ```kotlin import android.app.Application import android.util.Log import io.refiner.Refiner class MainApp : Application() { override fun onCreate() { super.onCreate() try { Refiner.initialize( context = this, projectId = "56421950-5d32-11ea-9bb4-9f1f1a987a49", debugMode = false // Set to true for development logging ) } catch (e: Exception) { Log.e("Refiner", "Initialization failed: ${e.message}") } } } ``` -------------------------------- ### Initialize Refiner SDK in Android Application Source: https://github.com/refiner-io/mobile-sdk-android/blob/main/README.md This Kotlin code demonstrates how to initialize the Refiner SDK within your Android application's onCreate method. It requires the application context, your project ID, and a debug mode flag. ```kotlin class MyApp : Application() { override fun onCreate() { super.onCreate() try { Refiner.initialize( context = this, projectId = "PROJECT_ID", debugMode = false ) } catch (e: Exception) { Log.e("Refiner", e.printStackTrace().toString()) } } } ``` -------------------------------- ### Register onNavigation Callback (Kotlin) Source: https://github.com/refiner-io/mobile-sdk-android/blob/main/README.md Receive notifications when the user navigates through a survey. This callback provides details about the current form, element, and progress, enabling tracking of user interaction within the survey. ```kotlin Refiner.onNavigation { formId, formElement, progress -> Log.i( TAG, "onNavigation \nformId: $formId \nformElement: $formElement \nprogress: $progress" ) } ``` -------------------------------- ### Register onShow Callback (Kotlin) Source: https://github.com/refiner-io/mobile-sdk-android/blob/main/README.md Execute code when a survey widget becomes visible to the user. This callback is useful for analytics or triggering other UI elements once the survey is presented. ```kotlin Refiner.onShow { formId -> Log.i(TAG, "onShow \nformId: $formId") } ``` -------------------------------- ### Initiate Survey Check (Ping) (Kotlin) Source: https://github.com/refiner-io/mobile-sdk-android/blob/main/README.md Initiates a check for scheduled surveys for the current user. This is useful for time-based triggers or when audience targeting relies on backend data. Can be called at key moments like app re-opening. ```kotlin Refiner.ping() ``` -------------------------------- ### Session and Project Management Source: https://context7.com/refiner-io/mobile-sdk-android/llms.txt Methods for initiating survey checks, managing user sessions, changing the Refiner project ID, and updating the locale. ```APIDOC ## ping ### Description Initiate checks for scheduled surveys. Call at key moments in the user journey. ### Method `Refiner.ping()` ### Parameters None ### Request Example ```kotlin // Check for surveys when app returns to foreground Refiner.ping() ``` ### Response #### Success Response (200) N/A #### Response Example N/A ## startSession ### Description Manually start a new user session (automatically detected after 1 hour of inactivity). ### Method `Refiner.startSession()` ### Parameters None ### Request Example ```kotlin // Start new session when app opens Refiner.startSession() ``` ### Response #### Success Response (200) N/A #### Response Example N/A ## setProject ### Description Change the Refiner project ID at runtime without reinitializing the SDK. ### Method `Refiner.setProject(projectId: String)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin // Switch to different project/environment Refiner.setProject(projectId = "new-project-uuid-here") ``` ### Response #### Success Response (200) N/A #### Response Example N/A ## setLocale ### Description Update locale for anonymous users after identification. ### Method `Refiner.setLocale(locale: String)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin // Update user's language preference Refiner.setLocale(locale = "fr") ``` ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Register onBeforeShow Callback (Kotlin) Source: https://github.com/refiner-io/mobile-sdk-android/blob/main/README.md Execute custom code immediately before a survey is displayed. This callback allows for conditional logic, such as aborting the survey display based on its ID or configuration. ```kotlin Refiner.onBeforeShow { formId, formConfig -> Log.i(TAG, "onBeforeShow \nformId: $formId \nformConfig: $formConfig") if (formId == "ABC") { Log.i(TAG, "Abort mission") } else { Log.i(TAG, "Continue and show survey") } } ``` -------------------------------- ### Contextual Data Management Source: https://context7.com/refiner-io/mobile-sdk-android/llms.txt Methods for attaching contextual data to survey submissions and clearing it. ```APIDOC ## addToResponse ### Description Attach contextual data to survey submissions for richer response analysis. ### Method `Refiner.addToResponse(contextualData: HashMap?)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **contextualData** (HashMap) - Optional - A map of key-value pairs representing contextual data. Set to `null` to clear existing data. ### Request Example ```kotlin // Add context about current user session Refiner.addToResponse( contextualData = hashMapOf( Pair("current_page", "checkout"), Pair("cart_value", 149.99), Pair("items_in_cart", 3), Pair("promo_code_applied", "SUMMER20"), Pair("session_duration_seconds", 342) ) ) // Clear contextual data Refiner.addToResponse(contextualData = null) ``` ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Register onComplete Callback (Kotlin) Source: https://github.com/refiner-io/mobile-sdk-android/blob/main/README.md Execute code when a user successfully completes and submits a survey. This callback receives the form ID and the submitted form data, enabling data processing or follow-up actions. ```kotlin Refiner.onComplete { formId, formData -> Log.i(TAG, "onComplete \nformId: $formId \nformData: $formData") } ``` -------------------------------- ### Set Project Environment (Kotlin) Source: https://github.com/refiner-io/mobile-sdk-android/blob/main/README.md Dynamically change the project UUID at runtime after the SDK has been initialized. This allows switching between different Refiner project environments without re-initializing the SDK. ```kotlin Refiner.setProject(projectId ="PROJECT_ID") ``` -------------------------------- ### Identify User with Advanced Parameters (Kotlin) Source: https://github.com/refiner-io/mobile-sdk-android/blob/main/README.md Identifies a user with their ID, traits, locale, and an optional identity verification signature. Supports 'append' or 'replace' data storage modes for user traits. Handles exceptions during the process. ```kotlin try { Refiner.identifyUser( userId = "USER_ID", userTraits = linkedMapOf( Pair("email", "hello@hello.com"), Pair("a_number", 123), Pair("a_date", "2022-16-04 12:00:00") ), locale = "en", signature = "SIGNATURE", writeOperation = Refiner.WriteOperation.APPEND //or Refiner.WriteOperation.REPLACE ) } catch (e: Exception) { Log.e("Refiner", e.printStackTrace().toString()) } ``` -------------------------------- ### Attach Contextual Data to Survey (Kotlin) Source: https://github.com/refiner-io/mobile-sdk-android/blob/main/README.md Append contextual data to survey submissions using the `addToResponse` method. Setting the `contextualData` parameter to `null` will remove any previously attached data. ```kotlin Refiner.addToResponse( contextualData = hashMapOf( Pair("some_data", "hello"), Pair("some_more_data", "hello again"), ) ) ``` -------------------------------- ### Show Survey (Android Kotlin) Source: https://context7.com/refiner-io/mobile-sdk-android/llms.txt Manually trigger the display of a survey. The `force` parameter can be used to bypass targeting rules for testing purposes. This function requires the `formUuid` of the survey to be displayed. ```kotlin import io.refiner.Refiner // Show survey based on targeting rules Refiner.showForm(formUuid = "f1cd5620-60e2-11ea-933e-c12a4e219567") // Force show survey (bypass targeting - for testing only) Refiner.showForm(formUuid = "f1cd5620-60e2-11ea-933e-c12a4e219567", force = true) ``` -------------------------------- ### Callback Functions Source: https://context7.com/refiner-io/mobile-sdk-android/llms.txt Register callback functions to execute code at specific moments in the survey lifecycle. ```APIDOC ## Callback Functions ### Description Register callbacks to execute code at specific moments in the survey lifecycle. ### Methods - `Refiner.onBeforeShow { formId, formConfig -> ... }`: Called before a survey is shown. Can be used to abort display. - `Refiner.onShow { formId -> ... }`: Called when a survey becomes visible. - `Refiner.onNavigation { formId, formElement, progress -> ... }`: Called as the user progresses through the survey. - `Refiner.onComplete { formId, formData -> ... }`: Called when a survey is completed and submitted. - `Refiner.onDismiss { formId -> ... }`: Called when the user dismisses a survey via the close button. - `Refiner.onClose { formId -> ... }`: Called when a survey disappears from the screen. - `Refiner.onError { message -> ... }`: Called when an error occurs during survey processing. ### Parameters Each callback function receives specific parameters relevant to the event. Refer to the code examples for details. ### Request Example ```kotlin import android.util.Log import io.refiner.Refiner // Called before survey is shown - can be used to abort display Refiner.onBeforeShow { formId, formConfig -> Log.i("Refiner", "About to show form: $formId") // Check conditions before showing if (formId == "specific-form-id") { Log.i("Refiner", "Preparing special handling for this form") } } // Called when survey becomes visible Refiner.onShow { formId -> Log.i("Refiner", "Survey displayed: $formId") // Pause background music, disable other interactions, etc. } // Called as user progresses through survey Refiner.onNavigation { formId, formElement, progress -> Log.i("Refiner", "Survey progress: $progress% on form: $formId, element: $formElement") } // Called when survey is completed and submitted Refiner.onComplete { formId, formData -> Log.i("Refiner", "Survey completed: $formId") Log.i("Refiner", "Response data: $formData") // Navigate to thank you screen, grant reward, etc. } // Called when user dismisses survey via X button Refiner.onDismiss { formId -> Log.i("Refiner", "Survey dismissed: $formId") } // Called when survey disappears from screen Refiner.onClose { formId -> Log.i("Refiner", "Survey closed: $formId") // Resume normal app behavior } // Called when an error occurs Refiner.onError { message -> Log.e("Refiner", "Survey error: $message") // Handle error, show fallback UI, report to crash analytics } ``` ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Track Current Screen (Kotlin) Source: https://github.com/refiner-io/mobile-sdk-android/blob/main/README.md Tracks the name of the screen the user is currently viewing. This information can be used to trigger surveys in specific parts of the application. It's recommended to track only relevant screens for survey targeting. ```kotlin Refiner.trackScreen(screenName = "SCREEN_NAME") ``` -------------------------------- ### Set User Data Locally (Kotlin) Source: https://context7.com/refiner-io/mobile-sdk-android/llms.txt Use `setUser` as an alternative to `identifyUser` to store user data locally. Data is synced to Refiner servers upon a meaningful action, helping to minimize the number of tracked users. It requires `userId`, `userTraits`, and `locale`. ```kotlin import io.refiner.Refiner try { Refiner.setUser( userId = "user-12345", userTraits = linkedMapOf( Pair("email", "john.doe@example.com"), Pair("account_type", "business"), Pair("trial_days_remaining", 7) ), locale = "de", signature = null // Optional for development ) } catch (e: Exception) { Log.e("Refiner", "Set user failed: ${e.message}") } ``` -------------------------------- ### Track User Event (Kotlin) Source: https://github.com/refiner-io/mobile-sdk-android/blob/main/README.md Tracks a specific event performed by the user. Tracked events can be used for creating user segments and targeted audiences within Refiner. ```kotlin Refiner.trackEvent(eventName = "EVENT_NAME") ``` -------------------------------- ### Ping for Surveys (Android Kotlin) Source: https://context7.com/refiner-io/mobile-sdk-android/llms.txt Initiate checks for scheduled surveys. This function should be called at key moments in the user journey to ensure timely survey delivery. ```kotlin import io.refiner.Refiner // Check for surveys when app returns to foreground Refiner.ping() ``` -------------------------------- ### Add Contextual Data (Android Kotlin) Source: https://context7.com/refiner-io/mobile-sdk-android/llms.txt Attach contextual data to survey submissions to enrich response analysis. This data can include user session information, cart details, or any other relevant context. Contextual data can also be cleared by passing `null`. ```kotlin import io.refiner.Refiner // Add context about current user session Refiner.addToResponse( contextualData = hashMapOf( Pair("current_page", "checkout"), Pair("cart_value", 149.99), Pair("items_in_cart", 3), Pair("promo_code_applied", "SUMMER20"), Pair("session_duration_seconds", 342) ) ) // Clear contextual data Refiner.addToResponse(contextualData = null) ``` -------------------------------- ### Add Refiner SDK Dependency (Gradle) Source: https://context7.com/refiner-io/mobile-sdk-android/llms.txt This snippet shows how to add the Refiner SDK dependency to your Android project's `build.gradle` file and configure Maven Central repositories. Ensure you are using a compatible Android Gradle plugin version. ```gradle // app/build.gradle dependencies { implementation 'io.refiner:refiner:1.6.0' } // project/build.gradle allprojects { repositories { mavenCentral() } } ``` -------------------------------- ### Add Refiner SDK Dependency to Android Project Source: https://github.com/refiner-io/mobile-sdk-android/blob/main/README.md This snippet shows how to add the Refiner Android SDK dependency to your app's build.gradle file. Ensure you have mavenCentral() configured in your project's build.gradle file. ```gradle dependencies { implementation 'io.refiner:refiner:latest.release' } allprojects { repositories { mavenCentral() } } ``` -------------------------------- ### Set User with Local Data Storage (Kotlin) Source: https://github.com/refiner-io/mobile-sdk-android/blob/main/README.md An alternative to 'Identify User' that stores user ID and traits locally without immediate server communication. User data is sent to Refiner servers only when a meaningful action is performed or a survey is shown. This helps minimize tracked users in Refiner. ```kotlin try { Refiner.setUser( userId = "USER_ID", userTraits = linkedMapOf( Pair("email", "hello@hello.com"), Pair("a_number", 123), Pair("a_date", "2022-16-04 12:00:00") ), locale = "en", signature = "SIGNATURE" ) } catch (e: Exception) { Log.e("Refiner", e.printStackTrace().toString()) } ``` -------------------------------- ### Identify User with Traits (Kotlin) Source: https://context7.com/refiner-io/mobile-sdk-android/llms.txt Identify a user by providing a unique `userId` and associated `userTraits`. This method immediately syncs user data to Refiner servers, enabling segmentation and targeting. Optional parameters include `locale`, `signature` for verification, and `writeOperation` to control trait updates. ```kotlin import io.refiner.Refiner try { Refiner.identifyUser( userId = "user-12345", userTraits = linkedMapOf( Pair("email", "john.doe@example.com"), Pair("plan", "premium"), Pair("signup_date", "2024-01-15 10:30:00"), Pair("orders_count", 42), Pair("is_verified", true) ), locale = "en", // ISO 639-1 language code signature = "hmac-signature-for-verification", // Optional: Identity Verification writeOperation = Refiner.WriteOperation.APPEND // or REPLACE to overwrite traits ) } catch (e: Exception) { Log.e("Refiner", "User identification failed: ${e.message}") } ``` -------------------------------- ### Survey Display and Control Source: https://context7.com/refiner-io/mobile-sdk-android/llms.txt Methods for manually triggering survey display, closing surveys programmatically, and dismissing surveys while tracking analytics. ```APIDOC ## showForm ### Description Manually trigger a survey display. Use the `force` parameter to bypass targeting rules during testing. ### Method `Refiner.showForm(formUuid: String, force: Boolean = false)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin // Show survey based on targeting rules Refiner.showForm(formUuid = "f1cd5620-60e2-11ea-933e-c12a4e219567") // Force show survey (bypass targeting - for testing only) Refiner.showForm(formUuid = "f1cd5620-60e2-11ea-933e-c12a4e219567", force = true) ``` ### Response #### Success Response (200) N/A (This is a function call, not an API request/response) #### Response Example N/A ## closeForm ### Description Close a survey programmatically without sending data to the backend. ### Method `Refiner.closeForm(formUuid: String)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin // Close survey without notification Refiner.closeForm(formUuid = "f1cd5620-60e2-11ea-933e-c12a4e219567") ``` ### Response #### Success Response (200) N/A #### Response Example N/A ## dismissForm ### Description Close a survey and send a "dismissed at" timestamp to the backend for analytics. ### Method `Refiner.dismissForm(formUuid: String)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin // Dismiss survey with timestamp tracking Refiner.dismissForm(formUuid = "f1cd5620-60e2-11ea-933e-c12a4e219567") ``` ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Register onClose Callback (Kotlin) Source: https://github.com/refiner-io/mobile-sdk-android/blob/main/README.md Execute code when a survey widget is no longer visible on the screen. This callback can be used for cleanup tasks or to reset UI states after a survey has been closed. ```kotlin Refiner.onClose { formId -> Log.i(TAG, "onClose \nformId: $formId") } ``` -------------------------------- ### Register Survey Callback Functions (Android Kotlin) Source: https://context7.com/refiner-io/mobile-sdk-android/llms.txt Register callback functions to execute code at specific moments in the survey lifecycle. These callbacks allow for custom actions before a survey is shown, when it becomes visible, during navigation, upon completion, dismissal, or closure, and for error handling. ```kotlin import android.util.Log import io.refiner.Refiner // Called before survey is shown - can be used to abort display Refiner.onBeforeShow { formId, formConfig -> Log.i("Refiner", "About to show form: $formId") // Check conditions before showing if (formId == "specific-form-id") { Log.i("Refiner", "Preparing special handling for this form") } } // Called when survey becomes visible Refiner.onShow { formId -> Log.i("Refiner", "Survey displayed: $formId") // Pause background music, disable other interactions, etc. } // Called as user progresses through survey Refiner.onNavigation { formId, formElement, progress -> Log.i("Refiner", "Survey progress: $progress% on form: $formId, element: $formElement") } // Called when survey is completed and submitted Refiner.onComplete { formId, formData -> Log.i("Refiner", "Survey completed: $formId") Log.i("Refiner", "Response data: $formData") // Navigate to thank you screen, grant reward, etc. } // Called when user dismisses survey via X button Refiner.onDismiss { formId -> Log.i("Refiner", "Survey dismissed: $formId") } // Called when survey disappears from screen Refiner.onClose { formId -> Log.i("Refiner", "Survey closed: $formId") // Resume normal app behavior } // Called when an error occurs Refiner.onError { message -> Log.e("Refiner", "Survey error: $message") // Handle error, show fallback UI, report to crash analytics } ``` -------------------------------- ### Identify User with Traits in Refiner SDK Source: https://github.com/refiner-io/mobile-sdk-android/blob/main/README.md This Kotlin snippet shows how to identify a user in Refiner, optionally providing user traits. The userId is mandatory, while userTraits is an optional map accepting String, Int, or Boolean values. ```kotlin try { Refiner.identifyUser( userId = "USER_ID", userTraits = linkedMapOf( Pair("email", "hello@hello.com"), Pair("a_number", 123), Pair("a_date", "2022-16-04 12:00:00") ) ) } catch (e: Exception) { Log.e("Refiner", e.printStackTrace().toString()) } ``` -------------------------------- ### Register onError Callback (Kotlin) Source: https://github.com/refiner-io/mobile-sdk-android/blob/main/README.md Execute code when an error occurs during survey processing or display. This callback receives an error message, allowing for error handling and logging. ```kotlin Refiner.onError { message -> Log.i(TAG, "onError \nmessage: $message") } ``` -------------------------------- ### Register onDismiss Callback (Kotlin) Source: https://github.com/refiner-io/mobile-sdk-android/blob/main/README.md Execute code when the user explicitly dismisses a survey by clicking the close button. This callback is distinct from `onClose` as it signifies user intent to dismiss. ```kotlin Refiner.onDismiss { formId -> Log.i(TAG, "onDismiss \nformId: $formId") } ``` -------------------------------- ### Set Anonymous User ID (Kotlin) Source: https://github.com/refiner-io/mobile-sdk-android/blob/main/README.md Sets a unique anonymous identifier for tracking users who have not logged in. If not called, the SDK automatically generates and maintains an anonymous ID. ```kotlin Refiner.setAnonymousId(anonymousId = "ANONYMOUS_ID") ``` -------------------------------- ### Set User Locale (Kotlin) Source: https://github.com/refiner-io/mobile-sdk-android/blob/main/README.md Sets or updates the locale for anonymous users. This is useful for changing language preferences without re-identifying the user. The locale should be a two-letter ISO 639-1 language code. ```kotlin Refiner.setLocale(locale = "en") ``` -------------------------------- ### Dismiss Survey (Android Kotlin) Source: https://context7.com/refiner-io/mobile-sdk-android/llms.txt Close a survey and send a "dismissed at" timestamp to the backend for analytics. This allows tracking when users choose to close a survey. ```kotlin import io.refiner.Refiner // Dismiss survey with timestamp tracking Refiner.dismissForm(formUuid = "f1cd5620-60e2-11ea-933e-c12a4e219567") ``` -------------------------------- ### Reset Current User Session (Kotlin) Source: https://context7.com/refiner-io/mobile-sdk-android/llms.txt Call `resetUser()` to clear the current user session. This is typically used when a user logs out of the application. ```kotlin import io.refiner.Refiner // Reset user on logout Refiner.resetUser() ``` -------------------------------- ### Set Locale (Android Kotlin) Source: https://context7.com/refiner-io/mobile-sdk-android/llms.txt Update the locale for anonymous users after they have been identified. This function allows for dynamic language preference changes. ```kotlin import io.refiner.Refiner // Update user's language preference Refiner.setLocale(locale = "fr") ``` -------------------------------- ### Set Project ID (Android Kotlin) Source: https://context7.com/refiner-io/mobile-sdk-android/llms.txt Change the Refiner project ID at runtime without reinitializing the SDK. This is useful for switching between different project environments or configurations. ```kotlin import io.refiner.Refiner // Switch to different project/environment Refiner.setProject(projectId = "new-project-uuid-here") ``` -------------------------------- ### Close Survey Programmatically (Kotlin) Source: https://github.com/refiner-io/mobile-sdk-android/blob/main/README.md Programmatically close a survey without sending any data to the backend. Use `dismissForm` to close the survey and send a "dismissed at" timestamp. ```kotlin Refiner.closeForm(formUuid = "FORM_UUID") ``` ```kotlin Refiner.dismissForm(formUuid = "FORM_UUID") ``` -------------------------------- ### Set Anonymous User ID (Kotlin) Source: https://context7.com/refiner-io/mobile-sdk-android/llms.txt Assign a custom anonymous identifier to track users without requiring authentication. If `setAnonymousId` is not called, Refiner automatically generates an anonymous ID. ```kotlin import io.refiner.Refiner // Set custom anonymous identifier Refiner.setAnonymousId(anonymousId = "anon-device-abc123") ``` -------------------------------- ### Reset User Identifier (Kotlin) Source: https://github.com/refiner-io/mobile-sdk-android/blob/main/README.md Clear the previously set user identifier, typically called when a user logs out of the application. This ensures that subsequent survey interactions are not associated with the previous user. ```kotlin Refiner.resetUser() ``` -------------------------------- ### Close Survey (Android Kotlin) Source: https://context7.com/refiner-io/mobile-sdk-android/llms.txt Programmatically close a survey without sending any data to the backend. This is useful for scenarios where the survey needs to be dismissed without recording user interaction. ```kotlin import io.refiner.Refiner // Close survey without notification Refiner.closeForm(formUuid = "f1cd5620-60e2-11ea-933e-c12a4e219567") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.