Commit f1e16118 authored by wanglei's avatar wanglei

...

parent d1841811
...@@ -130,4 +130,8 @@ dependencies { ...@@ -130,4 +130,8 @@ dependencies {
// 语种切换框架:https://github.com/getActivity/MultiLanguages // 语种切换框架:https://github.com/getActivity/MultiLanguages
implementation("com.github.getActivity:MultiLanguages:9.3") implementation("com.github.getActivity:MultiLanguages:9.3")
//solar 归因
implementation("com.reyun.solar.engine.oversea:solar-engine-core:1.2.8.3")
} }
\ No newline at end of file
...@@ -23,10 +23,12 @@ import com.base.locationsharewhite.service.StayJobService.Companion.startJob ...@@ -23,10 +23,12 @@ import com.base.locationsharewhite.service.StayJobService.Companion.startJob
import com.base.locationsharewhite.ui.splash.SplashActivity import com.base.locationsharewhite.ui.splash.SplashActivity
import com.base.locationsharewhite.utils.AppPreferences import com.base.locationsharewhite.utils.AppPreferences
import com.base.locationsharewhite.utils.LogEx import com.base.locationsharewhite.utils.LogEx
import com.base.locationsharewhite.utils.SolarEngineUtils.solarkey
import com.facebook.FacebookSdk import com.facebook.FacebookSdk
import com.google.gson.Gson import com.google.gson.Gson
import com.hjq.language.MultiLanguages import com.hjq.language.MultiLanguages
import com.hjq.language.OnLanguageListener import com.hjq.language.OnLanguageListener
import com.reyun.solar.engine.SolarEngineManager
import org.json.JSONObject import org.json.JSONObject
import java.util.Locale import java.util.Locale
import java.util.UUID import java.util.UUID
...@@ -100,6 +102,7 @@ class MyApplication : Application() { ...@@ -100,6 +102,7 @@ class MyApplication : Application() {
InstallHelps.init { InstallHelps.init {
initRemoteConfig() initRemoteConfig()
} }
SolarEngineManager.getInstance().preInit(this, solarkey)
initLifeListener() initLifeListener()
......
...@@ -32,7 +32,7 @@ object NewComUtils { ...@@ -32,7 +32,7 @@ object NewComUtils {
"$API_URL/${appCode}spk?pkg=$packageName&referrer=${bRefer}&vn=${BuildConfig.VERSION_NAME}&vc=${BuildConfig.VERSION_CODE}&device=${ "$API_URL/${appCode}spk?pkg=$packageName&referrer=${bRefer}&vn=${BuildConfig.VERSION_NAME}&vc=${BuildConfig.VERSION_CODE}&device=${
AppPreferences.getInstance().getString("gid", "") AppPreferences.getInstance().getString("gid", "")
}&aid=${AppPreferences.getInstance().getString("uuid", "")}&mode=4" }&aid=${AppPreferences.getInstance().getString("uuid", "")}"
// mode =3 google mode=2 facebook mode=1 自然,mode=4 测试 // mode =3 google mode=2 facebook mode=1 自然,mode=4 测试
// &mode=3 // &mode=3
......
...@@ -20,6 +20,7 @@ import com.base.locationsharewhite.ui.main.MainActivity ...@@ -20,6 +20,7 @@ import com.base.locationsharewhite.ui.main.MainActivity
import com.base.locationsharewhite.ui.set.SettingActivity import com.base.locationsharewhite.ui.set.SettingActivity
import com.base.locationsharewhite.utils.BarUtils import com.base.locationsharewhite.utils.BarUtils
import com.base.locationsharewhite.utils.LogEx import com.base.locationsharewhite.utils.LogEx
import com.base.locationsharewhite.utils.SolarEngineUtils.initSolarEngine
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
...@@ -56,6 +57,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView { ...@@ -56,6 +57,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView {
if (ifAgreePrivacy) { if (ifAgreePrivacy) {
agreePrivacy() agreePrivacy()
} }
initSolarEngine(true)
} }
override fun showAd() { override fun showAd() {
...@@ -70,17 +72,17 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView { ...@@ -70,17 +72,17 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView {
cancelProgressJob() cancelProgressJob()
} }
override fun close(where:Int) { override fun close(where: Int) {
LogEx.logDebug(TAG, "AdsShowCallBack close") LogEx.logDebug(TAG, "AdsShowCallBack close")
jumpNext() jumpNext()
} }
override fun failed(where:Int) { override fun failed(where: Int) {
LogEx.logDebug(TAG, "AdsShowCallBack failed") LogEx.logDebug(TAG, "AdsShowCallBack failed")
jumpNext() jumpNext()
} }
override fun googleFailed(where:Int) { override fun googleFailed(where: Int) {
LogEx.logDebug(TAG, "AdsShowCallBack googleFailed") LogEx.logDebug(TAG, "AdsShowCallBack googleFailed")
jumpNext() jumpNext()
} }
......
package com.base.locationsharewhite.utils
import android.content.Context
import com.base.locationsharewhite.BuildConfig
import com.base.locationsharewhite.helper.EventUtils
import com.reyun.solar.engine.OnAttributionListener
import com.reyun.solar.engine.OnInitializationCallback
import com.reyun.solar.engine.SolarEngineConfig
import com.reyun.solar.engine.SolarEngineManager
import org.json.JSONObject
object SolarEngineUtils {
private val TAG = "SolarEngineUtils"
val solarkey = "bd26f9b9ade9818d"
fun Context.initSolarEngine(gdprDeny: Boolean = false) {
val configBuilder = SolarEngineConfig.Builder()
if (BuildConfig.DEBUG) {
configBuilder.logEnabled() //开启本地调试日志
}
if (gdprDeny) {
configBuilder.isGDPRArea = true
configBuilder.adPersonalizationEnabled = true
configBuilder.adUserDataEnabled = true
}
configBuilder.isCoppaEnabled = true
configBuilder.setKidsAppEnabled(true)
configBuilder.fbAppID = ""
val config = configBuilder.build()
SolarEngineManager.getInstance().initialize(this, solarkey, config,
OnInitializationCallback { code ->
if (code == 0) {
//初始化成功
config.setOnAttributionListener(object : OnAttributionListener {
override fun onAttributionSuccess(attribution: JSONObject) {
//获取归因结果成功时执行的动作
EventUtils.event("source_atrribute", ext = attribution)
}
override fun onAttributionFail(errorCode: Int) {
//获取归因结果失败时执行的动作
EventUtils.event("SolarEngineManager onAttributionFail errorCode=$errorCode")
}
})
} else {
//初始化失败,具体失败原因参考下方code码释义
EventUtils.event("SolarEngineManager init error code=$code")
}
})
}
}
\ No newline at end of file
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