I am working on an app where i am supposed to add Livestream and Video Calling activities. I added GetStream Android SDK and created an Application class to initialize the SDK client. On each of the activities i am refencing the client instance to create the livestream or video call. Problem: I am launching the livestream activity with an Intent on button click but both Livestream and Video call activities are being lauched. Both are using the same user token. What could be the issue ?
StreamApplicationClass.kt
class StreamApplication:Application() {
override fun onCreate() {
super.onCreate()
initializeSDK()
}
private fun initializeSDK() {
val userId = "Kit_Fist"
val userName = "Broadcaster"
val userToken = "token"
// Step 1 - Create a user.
val user = User(
id = userId, // predefined string
name = userName, // Name and image are used in the UI
role = "admin",
)
// Step 2 - Initialize StreamVideo. For a production app, we recommend adding the client to your Application class or DI module.
val client = StreamVideoBuilder(
context = this,
apiKey = apikey,
user = user,
token = userToken,
).build()
}
}
Channels.kt
FloatingActionButton(
onClick = {
val intent = Intent(context, LivestreamActivity::class.java)
context.startActivity(intent)
},
shape = CircleShape,
)
LivestreamActivity
class LivestreamActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val call = StreamVideo.instance().call("livestream", "starter1")
lifecycleScope.launch {
call.join(create = true)
}
setContent{
VideoTheme{
LiveHost(call=call)
}
}
}
}
AndroidManifest.xml