Commit aa7bbe61 authored by wanglei's avatar wanglei

...

parent f417723e
...@@ -23,6 +23,7 @@ import com.base.datarecovery.bean.ConstObject ...@@ -23,6 +23,7 @@ import com.base.datarecovery.bean.ConstObject
import com.base.datarecovery.bean.ConstObject.SCAN_DOCUMENTS import com.base.datarecovery.bean.ConstObject.SCAN_DOCUMENTS
import com.base.datarecovery.bean.ConstObject.SCAN_PHOTOS import com.base.datarecovery.bean.ConstObject.SCAN_PHOTOS
import com.base.datarecovery.bean.ConstObject.SCAN_VIDEOS import com.base.datarecovery.bean.ConstObject.SCAN_VIDEOS
import com.base.datarecovery.utils.EventUtils
import kotlin.random.Random import kotlin.random.Random
...@@ -47,6 +48,7 @@ class StayNotificationService : Service() { ...@@ -47,6 +48,7 @@ class StayNotificationService : Service() {
startService(intent) startService(intent)
} }
} }
fun createPermanentNotification(context: Context): Notification { fun createPermanentNotification(context: Context): Notification {
val isOngoing = true //是否持续(为不消失的常驻通知) val isOngoing = true //是否持续(为不消失的常驻通知)
...@@ -141,6 +143,10 @@ class StayNotificationService : Service() { ...@@ -141,6 +143,10 @@ class StayNotificationService : Service() {
@SuppressLint("ForegroundServiceType") @SuppressLint("ForegroundServiceType")
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
if (intent == null) {
EventUtils.event("onStartCommand", "Foreground System auto launch intent=null isRunning=$isRunning")
return START_NOT_STICKY
}
if (!isRunning) { if (!isRunning) {
val notification = createPermanentNotification(applicationContext) val notification = createPermanentNotification(applicationContext)
......
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