Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
D
Data Recovery White
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
Data Recovery White
Commits
aa7bbe61
Commit
aa7bbe61
authored
Aug 19, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
f417723e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
StayNotificationService.kt
.../com/base/datarecovery/service/StayNotificationService.kt
+6
-0
No files found.
app/src/main/java/com/base/datarecovery/service/StayNotificationService.kt
View file @
aa7bbe61
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment