Commit 0145597a authored by 周文华's avatar 周文华

【修复】修复局部崩溃

parent 6b41d825
......@@ -33,7 +33,8 @@ object NotificationHoverUtils {
// 创建 Handler
if (handler == null) {
handlerThread?.let {
handler = Handler(it.getLooper())
val looper=it.getLooper()?:return
handler = Handler(looper)
}
}
......
......@@ -121,11 +121,15 @@ class StayJobService : JobService() {
private fun startForeground() {
val notification = createPermanentNotification(applicationContext)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
try {
startForeground(
NOTIFICATION_PERMANENT_ID,
notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC
)
} catch (e: Exception) {
//这里针对高版本的崩溃
}
} else {
startForeground(NOTIFICATION_PERMANENT_ID, notification)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment