Committed by
GitHub
Update compile and target sdk to Android 13 (#138)
* Update compile and target sdk to Android API level 33 * Update documentation on screen sharing notification for Android API level 33
正在显示
3 个修改的文件
包含
24 行增加
和
8 行删除
| @@ -5,8 +5,8 @@ ext { | @@ -5,8 +5,8 @@ ext { | ||
| 5 | java_version = JavaVersion.VERSION_1_8 | 5 | java_version = JavaVersion.VERSION_1_8 |
| 6 | dokka_version = '1.5.0' | 6 | dokka_version = '1.5.0' |
| 7 | androidSdk = [ | 7 | androidSdk = [ |
| 8 | - compileVersion: 32, | ||
| 9 | - targetVersion : 32, | 8 | + compileVersion: 33, |
| 9 | + targetVersion : 33, | ||
| 10 | minVersion : 21, | 10 | minVersion : 21, |
| 11 | ] | 11 | ] |
| 12 | versions = [ | 12 | versions = [ |
| 1 | package io.livekit.android.room.track | 1 | package io.livekit.android.room.track |
| 2 | 2 | ||
| 3 | +import android.Manifest | ||
| 3 | import android.app.Notification | 4 | import android.app.Notification |
| 5 | +import android.app.NotificationManager | ||
| 4 | import android.content.Context | 6 | import android.content.Context |
| 5 | import android.content.Intent | 7 | import android.content.Intent |
| 6 | import android.media.projection.MediaProjection | 8 | import android.media.projection.MediaProjection |
| @@ -9,6 +11,7 @@ import dagger.assisted.AssistedFactory | @@ -9,6 +11,7 @@ import dagger.assisted.AssistedFactory | ||
| 9 | import dagger.assisted.AssistedInject | 11 | import dagger.assisted.AssistedInject |
| 10 | import io.livekit.android.room.DefaultsManager | 12 | import io.livekit.android.room.DefaultsManager |
| 11 | import io.livekit.android.room.track.screencapture.ScreenCaptureConnection | 13 | import io.livekit.android.room.track.screencapture.ScreenCaptureConnection |
| 14 | +import io.livekit.android.room.track.screencapture.ScreenCaptureService | ||
| 12 | import org.webrtc.* | 15 | import org.webrtc.* |
| 13 | import java.util.* | 16 | import java.util.* |
| 14 | 17 | ||
| @@ -46,14 +49,27 @@ constructor( | @@ -46,14 +49,27 @@ constructor( | ||
| 46 | } | 49 | } |
| 47 | 50 | ||
| 48 | /** | 51 | /** |
| 49 | - * A foreground service is generally required prior to [startCapture]. This method starts up | ||
| 50 | - * a helper foreground service that only serves to display a notification while capturing. This | ||
| 51 | - * foreground service will stop upon the end of screen capture. | 52 | + * A foreground service is generally required prior to [startCapture] for screen capture. |
| 53 | + * This method starts up a helper foreground service that only serves to display a | ||
| 54 | + * notification while capturing. This foreground service will automatically stop | ||
| 55 | + * upon the end of screen capture. | ||
| 52 | * | 56 | * |
| 53 | * You may choose to use your own foreground service instead of this method, but it must be | 57 | * You may choose to use your own foreground service instead of this method, but it must be |
| 54 | - * started prior to calling [startCapture]. | 58 | + * started prior to calling [startCapture] and kept running for the duration of the screen share. |
| 55 | * | 59 | * |
| 56 | - * @see [io.livekit.android.room.track.screencapture.ScreenCaptureService.start] | 60 | + * **Notes:** If no notification is passed, a notification channel will be created and a default |
| 61 | + * notification will be shown. | ||
| 62 | + * | ||
| 63 | + * Beginning with Android 13, the [Manifest.permission.POST_NOTIFICATIONS] runtime permission | ||
| 64 | + * is required to show notifications. The foreground service will work without the permission, | ||
| 65 | + * but you must add the permission to your AndroidManifest.xml and request the permission at runtime | ||
| 66 | + * if you wish for your notification to be shown. | ||
| 67 | + * | ||
| 68 | + * @see [ScreenCaptureService.start] | ||
| 69 | + * | ||
| 70 | + * @param notificationId The identifier for this notification as per [NotificationManager.notify]; must not be 0. | ||
| 71 | + * If null, defaults to [ScreenCaptureService.DEFAULT_NOTIFICATION_ID]. | ||
| 72 | + * @param notification The notification to show. If null, a default notification will be shown. | ||
| 57 | */ | 73 | */ |
| 58 | suspend fun startForegroundService(notificationId: Int?, notification: Notification?) { | 74 | suspend fun startForegroundService(notificationId: Int?, notification: Notification?) { |
| 59 | serviceConnection.connect() | 75 | serviceConnection.connect() |
| @@ -27,7 +27,7 @@ open class ScreenCaptureService : Service() { | @@ -27,7 +27,7 @@ open class ScreenCaptureService : Service() { | ||
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | /** | 29 | /** |
| 30 | - * @param notificationId id of the notification to be used, or null for [DEFAULT_CHANNEL_ID] | 30 | + * @param notificationId id of the notification to be used, or null for [DEFAULT_NOTIFICATION_ID] |
| 31 | * @param notification notification to be used, or null for a default notification. | 31 | * @param notification notification to be used, or null for a default notification. |
| 32 | */ | 32 | */ |
| 33 | fun start(notificationId: Int?, notification: Notification?) { | 33 | fun start(notificationId: Int?, notification: Notification?) { |
-
请 注册 或 登录 后发表评论