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
7251408d
Commit
7251408d
authored
Nov 13, 2024
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接入引用sdk
parent
dcbc382b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
126 additions
and
8 deletions
+126
-8
build.gradle
video/app/build.gradle
+9
-6
MintsApplication.java
...c/main/java/com/duben/happyplayletu/MintsApplication.java
+3
-2
GravityEngineManager.kt
...a/com/duben/happyplayletu/manager/GravityEngineManager.kt
+98
-0
build.gradle
video/build.gradle
+16
-0
No files found.
video/app/build.gradle
View file @
7251408d
...
...
@@ -10,8 +10,8 @@ android {
applicationId
"com.duben.happyplayletu"
minSdkVersion
rootProject
.
ext
.
androidMinSdkVersion
targetSdkVersion
rootProject
.
ext
.
androidTargetSdkVersion
versionCode
72
4
versionName
"7.2.
4
"
versionCode
72
5
versionName
"7.2.
5
"
flavorDimensions
"default"
// dex突破65535的限制
...
...
@@ -223,16 +223,19 @@ dependencies {
// 穿山甲聚合 接入【穿山甲、快手】
implementation
"com.pangle.cn:mediation-sdk:6.4.1.5"
// 穿山甲Applog 上报组件(必须)
implementation
'com.bytedance.applog:RangersAppLog-Lite-cn:6.16.3'
// 穿山甲商业化转化组件(必须)
implementation
'com.bytedance.ads:AppConvert:1.3.0.5'
//
// 穿山甲Applog 上报组件(必须)
//
implementation 'com.bytedance.applog:RangersAppLog-Lite-cn:6.16.3'
//
// 穿山甲商业化转化组件(必须)
//
implementation 'com.bytedance.ads:AppConvert:1.3.0.5'
//埋点开发工具,DevTools是 Debug 环境下辅助开发者或测试人员进行应用内埋点验证和 SDK 接入问题排查的组件。请使用 debug 依赖,建议仅在 debug 下做调试
// debugImplementation 'com.bytedance.applog:RangersAppLog-DevTools:3.3.4'
// 腾讯播放器
implementation
"com.tencent.liteav:LiteAVSDK_Player:11.3.0.13176"
// 引力引擎
implementation
"cn.gravity.android:GravityEngineSDK:${LATEST_VERSION}"
testImplementation
'junit:junit:4.13.2'
androidTestImplementation
'androidx.test.ext:junit:1.1.3'
androidTestImplementation
'androidx.test.espresso:espresso-core:3.4.0'
...
...
video/app/src/main/java/com/duben/happyplayletu/MintsApplication.java
View file @
7251408d
...
...
@@ -11,7 +11,7 @@ import com.downloader.PRDownloader;
import
com.downloader.PRDownloaderConfig
;
import
com.duben.happyplayletu.ad.TTAdManagerHolder
;
import
com.duben.happyplayletu.common.Constant
;
import
com.duben.happyplayletu.manager.
CsjAppLog
Manager
;
import
com.duben.happyplayletu.manager.
GravityEngine
Manager
;
import
com.duben.happyplayletu.manager.TXCSDKService
;
import
com.duben.happyplayletu.manager.TalkingDataManager
;
import
com.duben.happyplayletu.net.LoanService
;
...
...
@@ -82,7 +82,8 @@ public class MintsApplication extends MultiDexApplication {
TXCSDKService
.
init
(
this
);
CsjAppLogManager
.
INSTANCE
.
init
(
this
);
// CsjAppLogManager.INSTANCE.init(this);
GravityEngineManager
.
INSTANCE
.
initGravityEngine
(
this
);
TalkingDataManager
.
INSTANCE
.
init
(
this
);
...
...
video/app/src/main/java/com/duben/happyplayletu/manager/GravityEngineManager.kt
0 → 100644
View file @
7251408d
package
com.duben.happyplayletu.manager
import
android.app.Application
import
android.text.TextUtils
import
cn.gravity.android.GEConfig
import
cn.gravity.android.GravityEngineSDK
import
cn.gravity.android.GravityEngineSDK.AutoTrackEventType
import
cn.gravity.android.InitializeCallback
import
com.bytedance.hume.readapk.HumeSDK
import
com.duben.happyplayletu.MintsApplication
import
com.duben.happyplayletu.utils.DeviceUuidFactory
import
com.duben.happyplayletu.utils.LogUtil
import
com.duben.happyplayletu.utils.MateUtils.getAppMetaData
import
com.duben.library.utils.json.JsonUtil
import
org.json.JSONObject
/**
* 描述:引力引擎SDK
* 作者:孟崔广
*/
object
GravityEngineManager
{
private
const
val
ACCESS_TOKEN
=
"T9ycxLEd4outVfGnr2cmpFhpuizklKqA"
private
const
val
ENABLE_SYNC_ATTRIBUTION
=
false
/**
* 初始化
*
* ACCESS_TOKEN : 项目通行证,同启动 SDK 时保持一致
USER_CLIENT_ID : 用户唯一 ID(例如 UID 或者设备 ID)
USER_CLIENT_NAME : 用户昵称
CHANNEL : 用户初始化渠道(例如 xiaomi、huawei 等)
ENABLE_SYNC_ATTRIBUTION : 是否开启同步获取归因信息,具体请参考同步归因
*/
fun
initGravityEngine
(
application
:
Application
)
{
try
{
// 在主线程中配置并启动SDK
val
config
:
GEConfig
=
GEConfig
.
getInstance
(
application
,
ACCESS_TOKEN
)
// 保存此实例,后续调用方法均需要用到
val
gravityEngineSDKInstance
=
GravityEngineSDK
.
setupAndStart
(
config
)
gravityEngineSDKInstance
.
initialize
(
ACCESS_TOKEN
,
DeviceUuidFactory
().
deviceUuid
.
toString
(),
DeviceUuidFactory
().
deviceUuid
.
toString
(),
createChannel
(),
object
:
InitializeCallback
{
override
fun
onFailed
(
errorMsg
:
String
,
initializeBody
:
JSONObject
?)
{
LogUtil
.
d
(
"mcg --> gravityEngineSDKInstance onFailed="
+
errorMsg
)
}
override
fun
onSuccess
(
responseJson
:
JSONObject
?,
initializeBody
:
JSONObject
?)
{
//responseJson=={"nameValuePairs":{"token":"b10c4ce9-b40b-3f89-b442-237fe82e5efd"}}
LogUtil
.
d
(
"mcg --> gravityEngineSDKInstance onSuccess="
+
JsonUtil
.
toJson
(
responseJson
)
)
enableAutoTrack
(
gravityEngineSDKInstance
)
}
},
ENABLE_SYNC_ATTRIBUTION
)
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
}
/**
* 开启自动采集
*/
fun
enableAutoTrack
(
gravityEngineSDKInstance
:
GravityEngineSDK
)
{
val
typeList
:
MutableList
<
AutoTrackEventType
>
=
ArrayList
()
typeList
.
add
(
AutoTrackEventType
.
APP_INSTALL
)
typeList
.
add
(
AutoTrackEventType
.
APP_END
)
typeList
.
add
(
AutoTrackEventType
.
APP_CRASH
)
typeList
.
add
(
AutoTrackEventType
.
APP_VIEW_SCREEN
)
typeList
.
add
(
AutoTrackEventType
.
APP_CLICK
)
gravityEngineSDKInstance
.
enableAutoTrack
(
typeList
)
}
private
fun
createChannel
():
String
{
var
channel
=
getAppMetaData
(
MintsApplication
.
getContext
(),
"CHANNEL_NAME"
)
try
{
// 穿山甲分包渠道
val
ttChannel
=
HumeSDK
.
getChannel
(
MintsApplication
.
getContext
())
if
(!
TextUtils
.
isEmpty
(
ttChannel
))
{
// 此处方式不能修改,已和后端约定
channel
=
channel
+
"_"
+
ttChannel
}
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
return
channel
}
}
\ No newline at end of file
video/build.gradle
View file @
7251408d
...
...
@@ -17,6 +17,13 @@ buildscript {
url
"https://artifact.bytedance.com/repository/pangle"
}
// 引力引擎 SDK
maven
{
url
'https://nexus.gravity-engine.com/repository/maven-releases/'
}
maven
{
url
'https://nexus.gravity-engine.com/repository/maven-snapshots/'
}
}
dependencies
{
classpath
'com.android.tools.build:gradle:7.1.1'
...
...
@@ -40,6 +47,15 @@ allprojects {
maven
{
url
"https://artifact.bytedance.com/repository/pangle"
}
// 引力引擎 SDK
maven
{
url
'https://nexus.gravity-engine.com/repository/maven-releases/'
}
maven
{
url
'https://nexus.gravity-engine.com/repository/maven-snapshots/'
}
}
}
...
...
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