Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_vedio
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_vedio
Commits
6b120d93
Commit
6b120d93
authored
Jul 04, 2024
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
7a09783f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
3 deletions
+69
-3
CsjAppLogManager.kt
...java/com/duben/miaoquplayletu/manager/CsjAppLogManager.kt
+69
-3
No files found.
video/app/src/main/java/com/duben/miaoquplayletu/manager/CsjAppLogManager.kt
View file @
6b120d93
...
...
@@ -4,12 +4,15 @@ import android.app.Application
import
android.text.TextUtils
import
com.bytedance.ads.convert.BDConvert
import
com.bytedance.applog.AppLog
import
com.bytedance.applog.IDataObserver
import
com.bytedance.applog.InitConfig
import
com.bytedance.applog.util.UriConstants
import
com.bytedance.hume.readapk.HumeSDK
import
com.duben.miaoquplayletu.MintsApplication
import
com.duben.miaoquplayletu.BuildConfig
import
com.duben.miaoquplayletu.MintsApplication
import
com.duben.miaoquplayletu.utils.LogUtil
import
com.duben.miaoquplayletu.utils.MateUtils.getAppMetaData
import
org.json.JSONObject
/**
...
...
@@ -17,7 +20,7 @@ import com.duben.miaoquplayletu.utils.MateUtils.getAppMetaData
*/
object
CsjAppLogManager
{
fun
init
(
application
:
Application
)
{
fun
init
(
application
:
Application
)
{
// 第一个参数APPID: 参考2.1节获取
// 第二个参数CHANNEL: 填写渠道信息,请注意不能为空
val
config
=
InitConfig
(
BuildConfig
.
GROMORE_APP_ID
,
createChannel
())
...
...
@@ -28,12 +31,75 @@ object CsjAppLogManager {
config
.
isLogEnable
=
BuildConfig
.
LOG_DEBUG
// true:开启日志,参考4.3节设置logger,false:关闭日志
AppLog
.
setEncryptAndCompress
(
true
)
// 加密开关,true开启,false关闭
config
.
setEnablePlay
(
true
)
// 配置心跳事件(时长统计)
/**
* 用于获取用户唯一性bd_did
* @description
*/
AppLog
.
addDataObserver
(
object
:
IDataObserver
{
/**
* 本地的id数据加载结果通知
* @param did device id
* @param iid install id
* @param ssid ssid
*/
override
fun
onIdLoaded
(
s
:
String
,
s1
:
String
,
s2
:
String
)
{}
/**
* 通知注册结果,以及id变化情况
* 仅主进程会被调用
* @param changed 是否和本地缓存有所不同
* @param oldDid 原device id
* @param newDid server返回新的device id
* @param oldIid 原install id
* @param newIid server返回新install id
* @param oldSsid 原ssid
* @param newSsid server返回新ssid
*/
override
fun
onRemoteIdGet
(
b
:
Boolean
,
s
:
String
?,
s1
:
String
,
s2
:
String
,
s3
:
String
,
s4
:
String
,
s5
:
String
)
{
val
bd_did
=
AppLog
.
getDid
()
LogUtil
.
d
(
"mcg --> 用户唯一性bd_did="
+
bd_did
)
}
/**
* Config拉取数据,和本地数据对比有变化的通知
* 仅主进程会被调用
* @param changed 是否和本地缓存有所不同
* @param config server返回新config内容
*/
override
fun
onRemoteConfigGet
(
b
:
Boolean
,
jsonObject
:
JSONObject
?)
{}
/**
* server拉取AbConfig数据,和本地数据对比有变化的通知
* 仅主进程会被调用
* @param changed 是否和本地缓存有所不同
* @param abConfig server返回新abConfig内容
*/
override
fun
onRemoteAbConfigGet
(
b
:
Boolean
,
jsonObject
:
JSONObject
)
{
LogUtil
.
d
(
"mcg -->---测试---返回全部进组信息"
,
""
+
jsonObject
.
toString
())
}
/**
* Vid变化通知
*/
override
fun
onAbVidsChange
(
s
:
String
,
s1
:
String
)
{}
})
//SDK会采集OAID、ANDROID_ID和其他的设备特征字段,请遵循相关合规要求在隐私弹窗后采集
//传入需要init的AppLog实例,若没有多个AppLog实例,则传入AppLog.getInstance()即可
BDConvert
.
getInstance
().
init
(
application
,
AppLog
.
getInstance
())
// 如果在 onCreate 阶段初始化拿不到 XXXActivity 则不需要传递第三个参数
AppLog
.
init
(
application
,
config
)
AppLog
.
setHeaderInfo
(
"csj_attribution"
,
1
)
// 请在用户授权后调用如下方法,start 开始实际采集用户信息+上报:
AppLog
.
start
()
// 在初始化后必须设置AppLog.setHeaderInfo("csj_attribution",1),否则会直接影响归因结果。
AppLog
.
setHeaderInfo
(
"csj_attribution"
,
1
)
}
...
...
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