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
@@ -12,145 +12,75 @@ Please follow the directions at [Jitpack.io](https://jitpack.io/#Constructor-io/
12
12
13
13
You can find this in your [Constructor.io dashboard](https://constructor.io/dashboard). Contact sales if you'd like to sign up, or support if you believe your company already has an account.
14
14
15
-
## 3. Implement the Autocomplete UI
16
-
17
-
In your Application class add the following code with your key:
15
+
## 3. Create a Client Instance
18
16
19
17
```kotlin
20
-
overridefunonCreate() {
21
-
super.onCreate()
22
-
ConstructorIo.init(this, "YOUR API KEY")
23
-
24
-
val fragment = supportFragmentManager.findFragmentById(R.id.fragment_suggestions) asSuggestionsFragment
To respond to a user selecting an autocomplete result, use the `onSuggestionSelected` method. If the autocomplete result has both a suggested term to search for and a group to search within (as in Apples in Juice Drinks), the group will be passed into the method.
47
-
48
-
### Performing Searches
49
-
To respond to a user performing a search (instead of selecting an autocomplete result), use the `onQuerySentToServer` method.
50
-
51
-
## 4. Customize the Autocomplete UI
18
+
importio.constructor.core.ConstructorIo
19
+
importio.constructor.core.ConstructorIoConfig
52
20
53
-
### Using the Default UI
21
+
// Create the client config
22
+
let config =ConstructorIoConfig("YOUR API KEY")
54
23
55
-
To use the default, out-of-the-box UI, add the Sample Suggestions Fragment to your layout:
// Return your custom adapter item layout id for suggestion
119
-
overrideval itemLayoutId:Int
120
-
get() =R.layout.item_suggestion
121
-
122
-
// Return your text view id - the text will be the suggestion.
123
-
overrideval suggestionNameId:Int
124
-
get() =R.id.suggestionName
125
-
126
-
// Return your text view id - the text will be the suggestion group name, if present
127
-
overrideval suggestionGroupNameId:Int
128
-
get() =R.id.suggestionGroupName
65
+
## 6. Request Browse Events
129
66
130
-
}
67
+
```kotlin
68
+
// Coming end of October
131
69
```
132
70
133
-
## 5. Instrument Behavioral Events
71
+
## 7. Instrument Behavioral Events
134
72
135
73
The Android Client sends behavioral events to [Constructor.io](http://constructor.io/) in order to continuously learn and improve results for future Autosuggest and Search requests. The Client only sends events in response to being called by the consuming app or in response to user interaction . For example, if the consuming app never calls the SDK code, no events will be sent. Besides the explicitly passed in event parameters, all user events contain a GUID based user ID that the client sets to identify the user as well as a session ID.
136
74
137
75
Three types of these events exist:
138
76
139
77
1.**General Events** are sent as needed when an instance of the Client is created or initialized
140
-
1.**Autocomplete Events** measure user interaction with autocomplete results and extending from `BaseSuggestionFragment` sends them automatically.
141
-
1.**Search Events** measure user interaction with search results and the consuming app has to explicitly instrument them itself
78
+
1.**Autocomplete Events** measure user interaction with autocomplete results
79
+
1.**Search Events** measure user interaction with search results
142
80
143
81
### Autocomplete Events
144
82
145
-
If you decide to extend from the `BaseSuggestionFragment`, these events are sent automatically.
146
-
147
83
```kotlin
148
-
importio.constructor.core.ConstructorIo
149
-
importio.constructor.core.ConstructorIoConfig
150
-
151
-
val config =ConstructorIoConfig("pharmacy-api-key")
152
-
ConstructorIo.init(this, config)
153
-
154
84
// Track when the user focuses into the search bar (searchTerm)
0 commit comments