Bind to screen sharing service after app killed and relaunched.
This commit is contained in:
parent
b486559469
commit
cf3d145cd6
@ -164,6 +164,9 @@ class VectorCallActivity : VectorBaseActivity<ActivityCallBinding>(), CallContro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bind to service in case of user killed the app while there is an ongoing call
|
||||||
|
bindToScreenCaptureService()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onNewIntent(intent: Intent?) {
|
override fun onNewIntent(intent: Intent?) {
|
||||||
@ -662,9 +665,13 @@ class VectorCallActivity : VectorBaseActivity<ActivityCallBinding>(), CallContro
|
|||||||
this,
|
this,
|
||||||
Intent(this, ScreenCaptureService::class.java)
|
Intent(this, ScreenCaptureService::class.java)
|
||||||
)
|
)
|
||||||
|
bindToScreenCaptureService(activityResult)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun bindToScreenCaptureService(activityResult: ActivityResult? = null) {
|
||||||
screenCaptureServiceConnection.bind(object : ScreenCaptureServiceConnection.Callback {
|
screenCaptureServiceConnection.bind(object : ScreenCaptureServiceConnection.Callback {
|
||||||
override fun onServiceConnected() {
|
override fun onServiceConnected() {
|
||||||
startScreenSharing(activityResult)
|
activityResult?.let { startScreenSharing(it) }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,9 @@ class ScreenCaptureServiceConnection @Inject constructor(
|
|||||||
fun bind(callback: Callback) {
|
fun bind(callback: Callback) {
|
||||||
this.callback = callback
|
this.callback = callback
|
||||||
|
|
||||||
if (!isBound) {
|
if (isBound) {
|
||||||
|
callback.onServiceConnected()
|
||||||
|
} else {
|
||||||
Intent(context, ScreenCaptureService::class.java).also { intent ->
|
Intent(context, ScreenCaptureService::class.java).also { intent ->
|
||||||
context.bindService(intent, this, 0)
|
context.bindService(intent, this, 0)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user