diff --git a/docs/xm-and-surveys/surveys/website-app-surveys/framework-guides.mdx b/docs/xm-and-surveys/surveys/website-app-surveys/framework-guides.mdx index caa0000fbc..9dfd5d8a44 100644 --- a/docs/xm-and-surveys/surveys/website-app-surveys/framework-guides.mdx +++ b/docs/xm-and-surveys/surveys/website-app-surveys/framework-guides.mdx @@ -33,6 +33,10 @@ Integrate the **Formbricks App Survey SDK** into your app using multiple options [Use our iOS SDK to quickly integrate surveys into your iOS applications.](https://formbricks.com/docs/app-surveys/framework-guides#swift) + + [Integrate surveys into your Android applications using our native Kotlin SDK.](https://formbricks.com/docs/app-surveys/framework-guides#android) + + ## Prerequisites @@ -409,6 +413,77 @@ Formbricks.cleanup(waitForOperations: true) { | environment-id | string | Formbricks Environment ID. | | app-url | string | URL of the hosted Formbricks instance. | + +Now, visit the [Validate Your Setup](#validate-your-setup) section to verify your setup! + +## Android + +Install the Formbricks Android SDK using the following steps: + +### Installation + +Add the Maven Central repository and the Formbricks SDK dependency to your application's `build.gradle.kts`: + +```kotlin +repositories { + google() + mavenCentral() +} + +dependencies { + implementation("com.formbricks:android:1.0.0") // replace with latest version +} +``` + +Enable DataBinding in your app's module build.gradle.kts: + +```kotlin +android { + buildFeatures { + dataBinding = true + } +} +``` + +### Usage + +```kotlin +// 1. Initialize the SDK +val config = FormbricksConfig.Builder( + "https://your-formbricks-server.com", + "YOUR_ENVIRONMENT_ID" +) + .setLoggingEnabled(true) + .setFragmentManager(supportFragmentManager) + .build() + +// 2. Setup Formbricks +Formbricks.setup(this, config) + +// 3. Identify the user +Formbricks.setUserId("user‑123") + +// 4. Track events +Formbricks.track("button_pressed") + +// 5. Set or add user attributes +Formbricks.setAttribute("test@web.com", "email") +Formbricks.setAttributes(mapOf(Pair("attr1", "val1"), Pair("attr2", "val2"))) + +// 6. Change language (no userId required): +Formbricks.setLanguage("de") + +// 7. Log out: +Formbricks.logout() +``` + +### Required Customizations + +| Name | Type | Description | +| -------------- | ------ | -------------------------------------- | +| environment-id | string | Formbricks Environment ID. | +| app-url | string | URL of the hosted Formbricks instance. | + ## Validate your setup Once you’ve completed the steps above, validate your setup by checking the Setup Checklist in the Settings. The widget status indicator should change from this: @@ -420,6 +495,10 @@ To this: ## Debugging Formbricks Integration + + The debug mode is only available in the JavaScript SDK and works exclusively in the browser. It is not supported in mobile SDKs such as React Native, iOS, or Android. + + Enabling debug mode in your browser can help troubleshoot issues with Formbricks. Here’s how to activate it and what to look for in the logs. ### Activate Debug Mode