Commit d875d7bd authored by leichao.gao's avatar leichao.gao

启动定时和fcm

parent b94dbc36
...@@ -7,9 +7,12 @@ import android.os.Bundle ...@@ -7,9 +7,12 @@ import android.os.Bundle
import com.base.datarecovery.activity.SplashActivity import com.base.datarecovery.activity.SplashActivity
import com.base.datarecovery.ads.AdmobOpenUtils import com.base.datarecovery.ads.AdmobOpenUtils
import com.base.datarecovery.bean.ConstObject.ifAgreePrivacy import com.base.datarecovery.bean.ConstObject.ifAgreePrivacy
import com.base.datarecovery.fcm.FCMManager
import com.base.datarecovery.fcm.RecoveryTimerManager
import com.base.datarecovery.help.BaseApplication import com.base.datarecovery.help.BaseApplication
import com.base.datarecovery.help.ConfigHelper import com.base.datarecovery.help.ConfigHelper
import com.base.datarecovery.utils.ActivityManagerUtils import com.base.datarecovery.utils.ActivityManagerUtils
import com.base.datarecovery.utils.AppPreferences
import com.base.datarecovery.utils.LogEx import com.base.datarecovery.utils.LogEx
import com.base.datarecovery.utils.NewComUtils import com.base.datarecovery.utils.NewComUtils
import com.google.android.gms.ads.MobileAds import com.google.android.gms.ads.MobileAds
...@@ -28,9 +31,22 @@ class MyApplication : BaseApplication() { ...@@ -28,9 +31,22 @@ class MyApplication : BaseApplication() {
} }
fun initApp() { fun initApp() {
FCMManager.initFirebase(this)
FCMManager.subscribeToTopic(packageName+"_push")
NewComUtils.requestCfg { NewComUtils.requestCfg {
val timerStatus: Int = AppPreferences.getInstance().getString("timerS", "1").toIntOrNull()?:1
if (timerStatus == 0) {
RecoveryTimerManager.getInstance().stopTaskTimer()
} else {
val timerDelay: Int = AppPreferences.getInstance().getString("timerDelay", "1").toIntOrNull()?:1
val timerInterval: Int = AppPreferences.getInstance().getString("timerInterval", "7").toIntOrNull()?:7
if (!RecoveryTimerManager.getInstance().isTaskTimerActive) {
RecoveryTimerManager.getInstance().scheduleTask(
(timerDelay * 60*1000).toLong(),
(timerInterval * 60*1000).toLong()
)
}
}
} }
if (ifAgreePrivacy) { if (ifAgreePrivacy) {
MobileAds.initialize(this) { initializationStatus -> MobileAds.initialize(this) { initializationStatus ->
......
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