Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
S
Super Cleaner Max
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
Super Cleaner Max
Commits
454c6ffe
Commit
454c6ffe
authored
Jun 08, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
======移除无用代码======
parent
39d17a28
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
3 additions
and
76 deletions
+3
-76
NotificationService.kt
.../test/basd/supercleanermax/display/NotificationService.kt
+2
-11
NotificationTimerTask.kt
...est/basd/supercleanermax/display/NotificationTimerTask.kt
+0
-40
NotificationUtils.kt
...om/test/basd/supercleanermax/display/NotificationUtils.kt
+1
-22
PushStrategy.kt
...ava/com/test/basd/supercleanermax/display/PushStrategy.kt
+0
-3
No files found.
app/src/main/java/com/test/basd/supercleanermax/display/NotificationService.kt
View file @
454c6ffe
...
@@ -22,23 +22,14 @@ class NotificationService : Service() {
...
@@ -22,23 +22,14 @@ class NotificationService : Service() {
stopSelf
()
stopSelf
()
return
START_NOT_STICKY
return
START_NOT_STICKY
}
}
// isRuning = true
// Log.d("MyService", "Service is start" + Process.myPid());
// initEvenParams()
// eventParams?.let {
// startTimer()
// }
initBroadcast
()
initBroadcast
()
val
notification
=
NotificationUtils
.
createPermanentNotification
(
applicationContext
)
val
notification
=
NotificationUtils
.
createPermanentNotification
(
applicationContext
)
startForeground
(
1
,
notification
)
startForeground
(
1
,
notification
)
return
START_STICKY
return
START_STICKY
}
}
private
fun
startTimer
()
{
// val pushManagement = ComUtils.getPushConfig()
// PeriodicTaskScheduler.getInstance().setPushParams(pushManagement)
// .setEventParam(eventParams).start(applicationContext)
}
fun
Context
.
initBroadcast
()
{
fun
Context
.
initBroadcast
()
{
val
filter
=
IntentFilter
()
val
filter
=
IntentFilter
()
...
...
app/src/main/java/com/test/basd/supercleanermax/display/NotificationTimerTask.kt
deleted
100644 → 0
View file @
39d17a28
package
com.test.basd.supercleanermax.display
import
android.util.Log
import
com.test.basd.supercleanermax.display.NotificationHelper.postActionNotification
import
com.test.basd.supercleanermax.helps.BaseApplication
import
com.test.basd.supercleanermax.helps.EventHelper
import
java.util.TimerTask
/**
* 循环推送任务
*/
class
NotificationTimerTask
(
val
eventParams
:
EventParams
?)
:
TimerTask
()
{
private
val
TAG
=
"NotificationTimerTask"
override
fun
run
()
{
oneShotNotification
()
}
fun
oneShotNotification
(
noLimit
:
Boolean
=
false
)
{
val
id
=
NotificationHelper
.
getPresentPushId
()
val
isPush
=
PushStrategy
.
isPush
(
id
,
eventParams
=
eventParams
)
val
log
=
"isPush=$isPush "
+
"id=${id} "
EventHelper
.
event
(
"pushCircleOrder_isPush"
,
log
)
Log
.
d
(
TAG
,
log
)
if
(
isPush
||
noLimit
)
{
val
extra
:
Int
?
=
null
// if (id == ID_PHONE_ACCELERATE) {
// extra = RamMemoryEx.getMemoryUsage(BaseApplication.context).toInt()
// Log.d("MyService", "ram: $extra")
// }
BaseApplication
.
context
.
postActionNotification
(
id
,
extra
,
200000
)
}
}
}
\ No newline at end of file
app/src/main/java/com/test/basd/supercleanermax/display/NotificationUtils.kt
View file @
454c6ffe
...
@@ -29,7 +29,7 @@ import com.test.basd.supercleanermax.service.FlashlightService
...
@@ -29,7 +29,7 @@ import com.test.basd.supercleanermax.service.FlashlightService
object
NotificationUtils
{
object
NotificationUtils
{
private
val
TAG
=
"NotificationUtils"
private
val
TAG
=
"NotificationUtils"
const
val
NOTIFICATION_TAG
=
"S
martClean
Notification"
const
val
NOTIFICATION_TAG
=
"S
uperCleanerMax
Notification"
private
const
val
CHANNEL_ID
=
"Misc"
private
const
val
CHANNEL_ID
=
"Misc"
fun
showNotification
(
fun
showNotification
(
...
@@ -187,29 +187,8 @@ object NotificationUtils {
...
@@ -187,29 +187,8 @@ object NotificationUtils {
Log
.
d
(
TAG
,
log
)
Log
.
d
(
TAG
,
log
)
EventHelper
.
event
(
"pushCircleOrder_isPush"
,
log
)
EventHelper
.
event
(
"pushCircleOrder_isPush"
,
log
)
if
(
isPush
)
{
if
(
isPush
)
{
// var extra: Int? = null
// if (id == ID_PHONE_ACCELERATE) {
// extra = RamMemoryEx.getMemoryUsage(BaseApplication.context).toInt()
// }
BaseApplication
.
context
.
postActionNotification
(
id
,
null
,
s
)
BaseApplication
.
context
.
postActionNotification
(
id
,
null
,
s
)
}
}
}
}
fun
isNotificationExist
(
context
:
Context
,
notificationId
:
Int
):
Boolean
{
// 获取 NotificationManagerCompat 实例
val
notificationManager
=
NotificationManagerCompat
.
from
(
context
)
// 获取当前活动的通知列表
val
notifications
:
MutableList
<
StatusBarNotification
>
=
notificationManager
.
activeNotifications
// 检查指定的通知是否在列表中
for
(
notification
in
notifications
)
{
if
(
notification
.
id
==
notificationId
)
{
return
true
}
}
return
false
}
}
}
app/src/main/java/com/test/basd/supercleanermax/display/PushStrategy.kt
View file @
454c6ffe
...
@@ -57,8 +57,6 @@ object PushStrategy {
...
@@ -57,8 +57,6 @@ object PushStrategy {
// }
// }
//是否上次推送间隔大于配置间隔
//是否上次推送间隔大于配置间隔
// val isOganic = UserChancelEx.isOrganicUser()
// val interval = if (isOganic) pushManagement.o_push_interval else pushManagement.all_push_interval
val
interval
=
configBean
.
all_push_interval
val
interval
=
configBean
.
all_push_interval
if
(!
canPushNextTime
(
interval
))
{
if
(!
canPushNextTime
(
interval
))
{
LogEx
.
logDebug
(
TAG
,
"================================总间隔拦截==============================="
)
LogEx
.
logDebug
(
TAG
,
"================================总间隔拦截==============================="
)
...
@@ -79,7 +77,6 @@ object PushStrategy {
...
@@ -79,7 +77,6 @@ object PushStrategy {
LogEx
.
logDebug
(
TAG
,
"================================app在前台拦截==============================="
)
LogEx
.
logDebug
(
TAG
,
"================================app在前台拦截==============================="
)
return
false
return
false
}
}
val
pid
=
Process
.
myPid
()
LogEx
.
logDebug
(
TAG
,
"可以发送通知了。。。"
)
LogEx
.
logDebug
(
TAG
,
"可以发送通知了。。。"
)
return
true
return
true
...
...
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