diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml
index 5d805c2..27a904d 100644
--- a/library/src/main/AndroidManifest.xml
+++ b/library/src/main/AndroidManifest.xml
@@ -7,6 +7,7 @@
+
= Build.VERSION_CODES.O && isRunOnForegroundService) {
- startForeground(
- NotificationHelper.NOTIFICATION_ID,
- NotificationHelper.createSimpleNotification(this@VersionService)
- )
+ val notification = NotificationHelper.createSimpleNotification(this@VersionService)
+ val notificationId = NotificationHelper.NOTIFICATION_ID
+ // 指定服务类型
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
+ startForeground(notificationId, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC)
+ } else {
+ startForeground(notificationId, notification)
+ }
Thread.sleep(500)
}
isServiceAlive = true