Commit 30f24aff authored by wanglei's avatar wanglei

...

parent a8a18e72
......@@ -253,7 +253,7 @@ class MyApplication : Application() {
private fun initConfig(config: String) {
// kotlin.runCatching {
kotlin.runCatching {
val configBean = Gson().fromJson(config, ConfigBean::class.java)
writeLogFile("config", config)
......@@ -276,7 +276,7 @@ class MyApplication : Application() {
//启动定时器
changeTimer()
// }
}
}
......
......@@ -13,6 +13,7 @@ import android.os.Build
import android.os.CountDownTimer
import androidx.work.Configuration
import com.base.scanqr.BuildConfig
import com.base.scanqr.helper.EventUtils
import com.base.scanqr.service.StayNotification.createPermanentNotification
import com.base.scanqr.utils.LogEx
......@@ -53,6 +54,7 @@ class StayJobService : JobService() {
}
private fun startForeground() {
try {
val notification = createPermanentNotification(applicationContext)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
startForeground(
......@@ -64,6 +66,9 @@ class StayJobService : JobService() {
startForeground(NOTIFICATION_STAY_ID, notification)
}
isRunning = true
} catch (e: Exception) {
EventUtils.event("start_foreground_service_error")
}
}
private fun notifyForeground() {
......
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