feat: enhance background streaming functionality with improved wake lock management
- Updated the wake lock duration in BackgroundStreamingHandler to 3 hours, ensuring the service remains active for longer periods. - Modified the keepAlive method to support both iOS and Android, allowing for better background task management across platforms. - Implemented a periodic keep-alive timer in VoiceCallService to refresh the wake lock every 5 minutes, enhancing service reliability during voice calls. - Added debug logging for successful keep-alive invocations, improving traceability of background operations.
This commit is contained in:
@@ -144,13 +144,13 @@ class BackgroundStreamingService : Service() {
|
||||
|
||||
private fun acquireWakeLock() {
|
||||
if (wakeLock?.isHeld == true) return
|
||||
|
||||
|
||||
val powerManager = getSystemService(Context.POWER_SERVICE) as PowerManager
|
||||
wakeLock = powerManager.newWakeLock(
|
||||
PowerManager.PARTIAL_WAKE_LOCK,
|
||||
"Conduit::StreamingWakeLock"
|
||||
).apply {
|
||||
acquire(15 * 60 * 1000L) // 15 minutes max
|
||||
acquire(3 * 60 * 60 * 1000L) // 3 hours max (refreshed every 5 minutes)
|
||||
}
|
||||
println("BackgroundStreamingService: Wake lock acquired")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user