Kotlin
Building the log in interface
To be able to log in, you will need to add three elements to the screen:
- A
Buttonto log in Alice - A
Buttonto log in Bob
Open MainActivity.kt and add it programmatically:
class MainActivity : ComponentActivity() {
private val chatState by viewModels<ChatViewModel>()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
LoginScreen()
}
}
}
@Composable
fun LoginScreen() {
val vm = LocalChatState.current
Column(
modifier = Modifier.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Button(onClick = { }) {
Text("Login as Alice")
}
Button(onClick = { }) {
Text("Login as Bob")
}
}
}
Build and Run
Run the project again to launch it in the simulator.

Creating an Android chat app
Create a Android application that enables users to message each other using the Android Client SDK and Kotlin.
手順
1
Introduction to this task2
Prerequisites3
Create a Vonage Application4
Create a conversation5
Create the users6
Generate JWTs7
Create an Android project8
Building the log in interface9
ChatClient10
Building the chat interface11
Chat events12
Sending a message13
What's next?