Skip to content

Commit c4f27dd

Browse files
committed
Merge branch '204-not-allowed-to-start-service-app-is-in-background'
2 parents 0d3cc65 + c4411a2 commit c4f27dd

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.2.2
2+
3+
* Fix: [Android] Fix cancelling call when app is in background throws [BackgroundServiceStartNotAllowedException](https://developer.android.com/reference/android/app/BackgroundServiceStartNotAllowedException). [Issue #204](https://github.com/cybex-dev/twilio_voice/issues/204)
4+
15
## 0.2.1
26

37
* Fix: [iOS] Race condition ending call remotely and locally results in a "End Call Failed: The operation couldn’t be completed." error. [Issue #184](https://github.com/cybex-dev/twilio_voice/issues/184)

android/src/main/kotlin/com/twilio/twilio_voice/fcm/VoiceFirebaseMessagingService.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.Manifest
44
import android.annotation.SuppressLint
55
import android.content.Context
66
import android.content.Intent
7+
import android.os.Build
78
import android.telecom.*
89
import android.util.Log
910
import androidx.annotation.RequiresPermission
@@ -162,7 +163,12 @@ class VoiceFirebaseMessagingService : FirebaseMessagingService(), MessageListene
162163
Intent(applicationContext, TVConnectionService::class.java).apply {
163164
action = TVConnectionService.ACTION_CANCEL_CALL_INVITE
164165
putExtra(TVConnectionService.EXTRA_CANCEL_CALL_INVITE, cancelledCallInvite)
165-
applicationContext.startService(this)
166+
// applicationContext.startService(this)
167+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
168+
applicationContext.startForegroundService(this) // Ensure it's started as a foreground service
169+
} else {
170+
applicationContext.startService(this)
171+
}
166172
}
167173
}
168174
//endregion

0 commit comments

Comments
 (0)