Android 14+/17 대응: Foreground Service 및 edge-to-edge 처리 적용#18
Merged
Conversation
Add LiveEventService as microphone+camera (host) or mediaPlayback (participant) foreground service started during LiveEventActivity lifecycle. Required for Android 14+ typed FGS enforcement and Android 17 background audio hardening, which silences AudioTrack write and fails requestAudioFocus for backgrounded apps without an active FGS with while-in-use capability. Apply android:fitsSystemWindows="true" to all activity layouts and windowOptOutEdgeToEdgeEnforcement to themes so content stops extending under the status and navigation bars on Android 15+. Bump targetSdk to 37.
Mirror the live-video-sample changes for the audio-only sample: - Bump AGP 7.4.2 → 8.5.2, Gradle 7.5 → 8.7, compileSdk 33 → 35, sendbird-live 1.1.2 → 1.2.8 to resolve transitive dependency (viewpager2:1.1.0, annotation-experimental:1.4.0) requirements. - Migrate source for live SDK 1.2.8 API: hostTypes/HostType → types/LiveEventType, liveEvent.host (single) → hosts.firstOrNull(), add onExited and onReconnected to LiveEventListenerImpl. - Add LiveEventService as microphone (host) or mediaPlayback (participant) foreground service started during LiveEventActivity lifecycle to prepare for Android 14+ typed FGS enforcement. - Apply android:fitsSystemWindows="true" to all activity layouts and windowOptOutEdgeToEdgeEnforcement to themes. Revert targetSdk to original (live-video-sample 35, live-audio-sample 33) to keep runtime behavior unchanged.
LiveEventOpenChannelFragment.setTitle calls fragment.getString as a fallback when the value is null or blank. The fragment is committed asynchronously in initOpenChannelView, so when entering an event that has no title (e.g., a video-sample-created event with empty title), getString runs before the fragment attaches and crashes with "Fragment not attached to a context". Resolve the fallback in the activity context (always available) before assigning to the fragment so the fragment never hits its own getString branch.
| val asHost = intent?.getBooleanExtra(EXTRA_AS_HOST, false) ?: false | ||
| val notification = buildNotification(liveEventId, asHost) | ||
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { | ||
| val type = if (asHost) { |
There was a problem hiding this comment.
live의 host는 항상 foreground로 있다는 것을 전제로 하는거겠죠?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
변경 요약
두 sample (
live-video-sample,live-audio-sample) 에 동일한 Android 14+/17 대응을 적용합니다.1. Foreground Service 추가
LiveEventService신설 — 호스트는microphone(+camerafor video), 참여자는mediaPlayback타입으로startForegroundLiveEventActivity(base) lifecycle 에서 service start/stop 처리FOREGROUND_SERVICE_MICROPHONE/FOREGROUND_SERVICE_CAMERA/FOREGROUND_SERVICE_MEDIA_PLAYBACK권한 선언2. Edge-to-edge 처리
android:fitsSystemWindows="true"추가 → status/navigation bar 영역으로 content 가 깔리지 않게 함android:windowOptOutEdgeToEdgeEnforcement추가 (Android 15 backstop)3. live-audio-sample SDK 1.2.8 마이그레이션
liveEvent.host(단일) →hosts.firstOrNull(),hostType/HostType→type/LiveEventType,LiveEventListener에onExited/onReconnected추가4. 두 sample compileSdk/targetSdk 36 으로 정렬
5. live-audio-sample 크래쉬 수정
LiveEventOpenChannelFragment.setTitle이 빈 title 일 때 fragment 의getString을 호출하는데, fragment commit 직후라 attach 안 된 상태에서 크래쉬 (Fragment not attached to a context)getString으로 fallback 을 미리 resolve 해서 fragment 가 자체getString분기에 도달하지 않도록 수정테스트 플랜
startForeground으로 fallback)adb shell dumpsys audio | grep AudioHardening— host activity 동안level: partialmute 이벤트 없음알려진 이슈
AppRTCAudioManagerdeprecatedrequestAudioFocusAPI →AudioFocusRequest.Buildermigration) 가 머지/릴리즈된 이후 재검증 필요. 본 PR 의 sample 변경으로는 해결 불가능한 영역.🤖 Generated with Claude Code