Skip to content

Commit ab4acaf

Browse files
authored
Merge pull request #40 from sendbird/feature/elliot/Update-README
Resolved conflict
2 parents dd98cd7 + 4099abd commit ab4acaf

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

android/README.md

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -229,22 +229,33 @@ There are two ways to display the messenger:
229229

230230
![Image](https://github.com/user-attachments/assets/74eea8d0-a984-4fb9-9c35-299b6b35b283)
231231

232-
The SDK provides a `MessengerLauncher` view, which can be added to any application screen via XML or programmatically.
233-
234-
When the screen containing the meesenger is launched, call the `init()` function of `MessengerLauncher` to specify which ai agent to communicate with.
232+
The SDK provides the `MessengerLauncher` view, which can be easily attached to your application's root view programmatically without directly adding it to XML layouts.
233+
234+
To add the MessengerLauncher to your screen, simply call the `attach()` function of `MessengerLauncher`, specifying the AI agent ID and configuration parameters:
235235
236-
> Note: The messenger can be used only after the initialize of AIAgentMessenger has finished. Use it after receiving `onInitSuccess` from the `MessengerInitResultHandler`.
237-
238-
```xml
239-
<com.sendbird.sdk.aiagent.messenger.ui.widget.MessengerLauncher
240-
android:id="@+id/messengerLauncher"
241-
android:layout_width="wrap_content"
242-
android:layout_height="wrap_content"/>
243-
```
244236
```kotlin
245-
messengerLauncher.init(aiAgentId = "your_ai_agent_id")
237+
val params = LauncherLayoutParams(
238+
LaunchMode.ANCHORED,
239+
LauncherMargin(12, 12, 12, 12),
240+
LauncherLocation.BOTTOM_END
241+
)
242+
243+
MessengerLauncher(context).attach(context, aiAgentId = "your_ai_agent_id", params = params)
246244
```
247245
246+
- `LauncherLayoutParams` allows you to configure the MessengerLauncher’s behavior and appearance:
247+
- **`launchMode`**:
248+
- `EXPANDED`: Opens the messenger in full-screen mode with predefined margins.
249+
- `ANCHORED`: Opens the messenger anchored near the launcher button, with adjustable positioning.
250+
251+
- **`margin`**: Defines the margin around the launcher button itself (does not affect the messenger window).
252+
253+
- **`location`**: Determines which corner of the screen the launcher will appear in. Available options are:
254+
- `TOP_START`
255+
- `TOP_END`
256+
- `BOTTOM_START`
257+
- `BOTTOM_END`
258+
248259
#### 2. Opening the conversation channel in full-screen mode
249260
250261
![Image](https://github.com/user-attachments/assets/348ccad1-ec9a-4851-9324-084eaf569e34)

0 commit comments

Comments
 (0)