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

增加渠道

parent dcdf0978
......@@ -55,23 +55,8 @@ class MyApplication : BaseApplication() {
FCMManager.initFirebase(this)
FCMManager.subscribeToTopic(topic)
LogEx.logDebug(TAG, "topic=${topic}")
ScreenStatusReceiver.setupScreenStatusListener(this)
InstallHelps.init()
NewComUtils.requestCfg {
ScreenStatusReceiver.setupScreenStatusListener(this)
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) {
MobileAds.initialize(this) { initializationStatus ->
}
......
......@@ -2,6 +2,8 @@ package com.base.datarecovery.utils
import com.android.installreferrer.api.InstallReferrerClient
import com.android.installreferrer.api.InstallReferrerStateListener
import com.base.datarecovery.fcm.RecoveryTimerManager
import com.base.datarecovery.fcm.ScreenStatusReceiver
import com.base.datarecovery.help.BaseApplication
import org.json.JSONObject
......@@ -21,6 +23,30 @@ object InstallHelps {
obj.put("appInstallTime", response.installBeginTimestampSeconds)
obj.put("instantExperienceLaunched", installInfo.toString())
EventUtils.event("install_referrer", ext = obj, isSingleEvent = true)
if (listOf("gclid", "facebook","instagram").all { !installInfo.contains(it, true) }) {
//自然用户
AppPreferences.getInstance().put("install_source","origin")
}else{
//渠道用户
AppPreferences.getInstance().put("install_source","channel")
}
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()
)
}
}
}
}
else -> {
......
......@@ -26,7 +26,7 @@ object NewComUtils {
private val url: String by lazy {
val packageName = ConfigHelper.packageName
val appCode = packageName.substringAfter(PACKAGE_NAME_PREFIX).take(5).toLowerCase(Locale.getDefault())
"$API_URL/$appCode spk?pkg=$packageName"
"$API_URL/$appCode spk?pkg=$packageName"+"&source="+AppPreferences.getInstance().getString("install_source","origin")
}
fun requestCfg(callback: (ConfigBean?) -> Unit) {
......
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