Commit 454c6ffe authored by wanglei's avatar wanglei

======移除无用代码======

parent 39d17a28
...@@ -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()
......
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
...@@ -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 = "SmartCleanNotification" const val NOTIFICATION_TAG = "SuperCleanerMaxNotification"
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
}
} }
...@@ -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
......
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