Commit 472989d0 authored by mengcuiguang's avatar mengcuiguang

添加引力sdk

parent d63ef004
...@@ -10,8 +10,8 @@ android { ...@@ -10,8 +10,8 @@ android {
applicationId "com.duben.happyplayletu" applicationId "com.duben.happyplayletu"
minSdkVersion rootProject.ext.androidMinSdkVersion minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 721 versionCode 722
versionName "7.2.1" versionName "7.2.2"
flavorDimensions "default" flavorDimensions "default"
// dex突破65535的限制 // dex突破65535的限制
...@@ -223,16 +223,18 @@ dependencies { ...@@ -223,16 +223,18 @@ dependencies {
// 穿山甲聚合 接入【穿山甲、快手】 // 穿山甲聚合 接入【穿山甲、快手】
implementation "com.pangle.cn:mediation-sdk:6.4.1.5" implementation "com.pangle.cn:mediation-sdk:6.4.1.5"
// 穿山甲Applog 上报组件(必须) // // 穿山甲Applog 上报组件(必须)
implementation 'com.bytedance.applog:RangersAppLog-Lite-cn:6.16.3' // implementation 'com.bytedance.applog:RangersAppLog-Lite-cn:6.16.3'
// 穿山甲商业化转化组件(必须) // // 穿山甲商业化转化组件(必须)
implementation 'com.bytedance.ads:AppConvert:1.3.0.5' // 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 "com.tencent.liteav:LiteAVSDK_Player:11.3.0.13176"
// 引力引擎 SDK
implementation "cn.gravity.android:GravityEngineSDK:4.8.11"
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
......
...@@ -12,6 +12,7 @@ import com.downloader.PRDownloaderConfig; ...@@ -12,6 +12,7 @@ import com.downloader.PRDownloaderConfig;
import com.duben.happyplayletu.ad.TTAdManagerHolder; import com.duben.happyplayletu.ad.TTAdManagerHolder;
import com.duben.happyplayletu.common.Constant; import com.duben.happyplayletu.common.Constant;
import com.duben.happyplayletu.manager.CsjAppLogManager; import com.duben.happyplayletu.manager.CsjAppLogManager;
import com.duben.happyplayletu.manager.GravityEngineManager;
import com.duben.happyplayletu.manager.TXCSDKService; import com.duben.happyplayletu.manager.TXCSDKService;
import com.duben.happyplayletu.manager.TalkingDataManager; import com.duben.happyplayletu.manager.TalkingDataManager;
import com.duben.happyplayletu.net.LoanService; import com.duben.happyplayletu.net.LoanService;
...@@ -82,7 +83,8 @@ public class MintsApplication extends MultiDexApplication { ...@@ -82,7 +83,8 @@ public class MintsApplication extends MultiDexApplication {
TXCSDKService.init(this); TXCSDKService.init(this);
CsjAppLogManager.INSTANCE.init(this); // CsjAppLogManager.INSTANCE.init(this);
GravityEngineManager.INSTANCE.initGravityEngine(this);
TalkingDataManager.INSTANCE.init(this); TalkingDataManager.INSTANCE.init(this);
......
package com.duben.happyplayletu.manager
import android.app.Application
import cn.gravity.android.GEConfig
import cn.gravity.android.GravityEngineSDK
import cn.gravity.android.InitializeCallback
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)
val channel = getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")
gravityEngineSDKInstance.initialize(
ACCESS_TOKEN,
DeviceUuidFactory().deviceUuid.toString(),
DeviceUuidFactory().deviceUuid.toString(),
channel,
object : InitializeCallback {
override fun onFailed(errorMsg: String, initializeBody: JSONObject?) {
LogUtil.d("mcg --> gravityEngineSDKInstance onFailed=" + errorMsg)
}
override fun onSuccess(responseJson: JSONObject?, initializeBody: JSONObject?) {
LogUtil.d(
"mcg --> gravityEngineSDKInstance onSuccess=" + JsonUtil.toJson(
responseJson
)
)
}
},
ENABLE_SYNC_ATTRIBUTION
)
} catch (e: Exception) {
e.printStackTrace()
}
}
}
\ No newline at end of file
...@@ -17,6 +17,14 @@ buildscript { ...@@ -17,6 +17,14 @@ buildscript {
url "https://artifact.bytedance.com/repository/pangle" 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 { dependencies {
classpath 'com.android.tools.build:gradle:7.1.1' classpath 'com.android.tools.build:gradle:7.1.1'
...@@ -40,6 +48,14 @@ allprojects { ...@@ -40,6 +48,14 @@ allprojects {
maven { maven {
url "https://artifact.bytedance.com/repository/pangle" 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/'
}
} }
} }
......
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