Skip to content

Commit b90f8d9

Browse files
committed
adds readme
1 parent cb77088 commit b90f8d9

1 file changed

Lines changed: 18 additions & 36 deletions

File tree

README.md

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
# Formbricks Android SDK
22

3-
**Formbricks Android SDK** provides an easy way to embed Formbricks surveys and feedback forms in your Android applications via a WebView or Fragment. It handles survey loading, analytics tracking, and secure communication with your Formbricks server.
4-
5-
---
6-
7-
## Features
8-
9-
- Full-screen survey support via a dedicated `Activity`.
10-
- Embedded survey support via a `Fragment` with `ViewBinding`.
11-
- Automatic JavaScript configuration and WebViewClient handling.
12-
- Optional analytics tracking integration.
13-
- Easy setup with Gradle and Maven Central.
14-
15-
---
3+
**Formbricks Android SDK** provides an easy way to embed Formbricks surveys and feedback forms in your Android applications via a WebView.
164

175
## Installation
186

@@ -25,27 +13,24 @@ repositories {
2513
}
2614

2715
dependencies {
28-
implementation("com.formbricks.android:android:0.1.0") // replace with latest version
16+
implementation("com.formbricks.android:android:1.0.0") // replace with latest version
2917
}
3018
```
3119

32-
Enable ViewBinding (and DataBinding if needed) in your app’s module build.gradle.kts:
20+
Enable DataBinding in your app’s module build.gradle.kts:
3321

3422
```kotlin
3523
android {
3624
buildFeatures {
37-
viewBinding = true
38-
// dataBinding = true // only if your own layouts use DataBinding
25+
dataBinding = true
3926
}
4027
}
4128
```
4229

4330
## Usage
4431

45-
1. Initialize the SDK
46-
In your Activity’s onCreate, configure and initialize Formbricks. You must supply the host’s supportFragmentManager:
47-
4832
```kotlin
33+
// 1. Initialize the SDK
4934
val config = FormbricksConfig.Builder(
5035
"https://your-formbricks-server.com",
5136
"YOUR_ENVIRONMENT_ID"
@@ -54,27 +39,24 @@ val config = FormbricksConfig.Builder(
5439
.setFragmentManager(supportFragmentManager)
5540
.build()
5641

57-
Formbricks.setup(this, config, true)
58-
Formbricks.setUserId("user-12345")
59-
```
42+
// 2. Setup Formbricks
43+
Formbricks.setup(this, config)
6044

61-
2. Open (trigger) a survey
62-
To display a survey, simply call Formbricks.track(...) with your survey URL. The SDK will handle launching its WebView internally:
45+
// 3. Identify the user
46+
Formbricks.setUserId("user‑123")
6347

64-
```kotlin
65-
Formbricks.track(
66-
event = "survey",
67-
properties = mapOf("url" to "https://your-formbricks-server.com/survey/abc123")
68-
)
69-
```
48+
// 4. Track events
49+
Formbricks.track("button_pressed")
7050

71-
This will open the survey in the SDK’s built-in WebView.
51+
// 5. Set or add user attributes
52+
Formbricks.setAttribute("test@web.com", "email")
53+
Formbricks.setAttributes(mapOf(Pair("attr1", "val1"), Pair("attr2", "val2")))
7254

73-
3. Track Custom Events
74-
You can also log arbitrary analytics events without UI:
55+
// 6. Change language (no userId required):
56+
Formbricks.setLanguage("de")
7557

76-
```kotlin
77-
Formbricks.track("button_clicked")
58+
// 7. Log out:
59+
Formbricks.logout()
7860
```
7961

8062
## Contributing

0 commit comments

Comments
 (0)