File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # android
2- Formbricks Android SDK
1+ # Formbricks Android SDK
2+
3+ ** Formbricks Android SDK** provides an easy way to embed Formbricks surveys and feedback forms in your Android applications via a WebView.
4+
5+ ## Installation
6+
7+ Add the Maven Central repository and the Formbricks SDK dependency to your application's ` build.gradle.kts ` :
8+
9+ ``` kotlin
10+ repositories {
11+ google()
12+ mavenCentral()
13+ }
14+
15+ dependencies {
16+ implementation(" com.formbricks.android:android:1.0.0" ) // replace with latest version
17+ }
18+ ```
19+
20+ Enable DataBinding in your app’s module build.gradle.kts:
21+
22+ ``` kotlin
23+ android {
24+ buildFeatures {
25+ dataBinding = true
26+ }
27+ }
28+ ```
29+
30+ ## Usage
31+
32+ ``` kotlin
33+ // 1. Initialize the SDK
34+ val config = FormbricksConfig .Builder (
35+ " https://your-formbricks-server.com" ,
36+ " YOUR_ENVIRONMENT_ID"
37+ )
38+ .setLoggingEnabled(true )
39+ .setFragmentManager(supportFragmentManager)
40+ .build()
41+
42+ // 2. Setup Formbricks
43+ Formbricks .setup(this , config)
44+
45+ // 3. Identify the user
46+ Formbricks .setUserId(" user‑123" )
47+
48+ // 4. Track events
49+ Formbricks .track(" button_pressed" )
50+
51+ // 5. Set or add user attributes
52+ Formbricks .setAttribute(" test@web.com" , " email" )
53+ Formbricks .setAttributes(mapOf (Pair (" attr1" , " val1" ), Pair (" attr2" , " val2" )))
54+
55+ // 6. Change language (no userId required):
56+ Formbricks .setLanguage(" de" )
57+
58+ // 7. Log out:
59+ Formbricks .logout()
60+ ```
61+
62+ ## Contributing
63+
64+ We welcome issues and pull requests on our GitHub repository.
65+
66+ ## License
67+
68+ This SDK is released under the MIT License.
You can’t perform that action at this time.
0 commit comments