You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-36Lines changed: 18 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,6 @@
1
1
# Formbricks Android SDK
2
2
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.
16
4
17
5
## Installation
18
6
@@ -25,27 +13,24 @@ repositories {
25
13
}
26
14
27
15
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
29
17
}
30
18
```
31
19
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:
33
21
34
22
```kotlin
35
23
android {
36
24
buildFeatures {
37
-
viewBinding =true
38
-
// dataBinding = true // only if your own layouts use DataBinding
25
+
dataBinding =true
39
26
}
40
27
}
41
28
```
42
29
43
30
## Usage
44
31
45
-
1. Initialize the SDK
46
-
In your Activity’s onCreate, configure and initialize Formbricks. You must supply the host’s supportFragmentManager:
47
-
48
32
```kotlin
33
+
// 1. Initialize the SDK
49
34
val config =FormbricksConfig.Builder(
50
35
"https://your-formbricks-server.com",
51
36
"YOUR_ENVIRONMENT_ID"
@@ -54,27 +39,24 @@ val config = FormbricksConfig.Builder(
54
39
.setFragmentManager(supportFragmentManager)
55
40
.build()
56
41
57
-
Formbricks.setup(this, config, true)
58
-
Formbricks.setUserId("user-12345")
59
-
```
42
+
// 2. Setup Formbricks
43
+
Formbricks.setup(this, config)
60
44
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")
63
47
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")
70
50
71
-
This will open the survey in the SDK’s built-in WebView.
0 commit comments