「Countly」

1、引入countly源码,高度为09d7817a38074cae8a6c34f94c04356b29f6a80f,引入原因是因为gradle、kotlin版本太高了,无法直接使用。需要自己定制化
This commit is contained in:
donghongyu
2024-10-29 19:09:53 +08:00
parent cb397d919a
commit 55500cb376
282 changed files with 29691 additions and 1 deletions

View File

@@ -78,4 +78,9 @@ dependencies {
}
annotationProcessor 'com.elegant.spi:compiler:1.0.3' //编译时库
// implementation 'ly.count.android:sdk:24.4.1'
// implementation 'ly.count.android:sdk-native:24.4.1'
implementation project(":libraries:countly:sdk")
implementation project(":libraries:countly:sdk-native")
}

View File

@@ -37,6 +37,7 @@
android:name=".NSDNettyActivity"
android:exported="false" />
<activity
android:exported="true"
android:name=".MainActivity"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize"
android:enabled="true"

View File

@@ -14,6 +14,9 @@ import com.mogo.skin.SkinManager;
import java.util.Random;
import ly.count.android.sdk.Countly;
import ly.count.android.sdk.CountlyConfig;
/**
*
*/
@@ -21,6 +24,10 @@ public class MoGoApplication extends MultiDexApplication {
private static final String TAG = "MoGoApplication";
private String COUNTLY_APP_KEY = "b03e1aeb596d75cc8a7d186db0889ed7d1f55ce1";
private String COUNTLY_SERVER_URL = "http://172.30.10.190";
@Override
public void onCreate() {
super.onCreate();
@@ -75,5 +82,56 @@ public class MoGoApplication extends MultiDexApplication {
clientConfig.setUseOriginSocket(true);
// 初始化SDK可以设置状态回调来监听
MoGoAiCloudClient.getInstance().init(this, clientConfig);
CountlyConfig countlyConfig =
// 创建配置对象
new CountlyConfig(
this,
COUNTLY_APP_KEY,
COUNTLY_SERVER_URL
);
// 设置设备唯一标志
countlyConfig.setDeviceId("202309055W83WSZ")
// 获取您在 Countly 服务器中设置的一些配置
.enableServerConfiguration()
// 自动视图跟踪
.enableAutomaticViewTracking()
.enableAutomaticViewShortNames()
.enableTemporaryDeviceIdMode()
// 参数篡改保护salt
.setParameterTamperingProtectionSalt("mogo_auto")
// 如果发送到服务器的数据足够短SDK 将使用 HTTP GET 请求。要覆盖该行为,
// 以便在所有情况下都使用 HTTP POST 请求,您需要在 init 配置中将“setHttpPostForced”标志设置为 true。
.setHttpPostForced(true)
// 启用日志记录:
.setLoggingEnabled(true);
// 限制每个线程记录的堆栈跟踪行默认值30 行)
countlyConfig.sdkInternalLimits.setMaxStackTraceLinesPerThread(10000);
// 限制每个堆栈跟踪行允许的字符默认200 个字符)
countlyConfig.sdkInternalLimits.setMaxStackTraceLineLength(10000);
// 限制所有用户设置的字符串分段或其等效值值的大小默认值256 个字符)
countlyConfig.sdkInternalLimits.setMaxValueSize(10000);
// 限制用户设置的分段键值对的数量默认100 个条目)
countlyConfig.sdkInternalLimits.setMaxSegmentationValues(1000);
// 限制可以记录的用户设置痕迹导航的数量默认值100 个条目,超过此值将删除最早的条目)
countlyConfig.sdkInternalLimits.setMaxBreadcrumbCount(1000);
// 自动崩溃处理
countlyConfig.crashes.enableCrashReporting();
// 记录所有线程
countlyConfig.crashes.enableRecordAllThreadsWithCrash();
// 初始化Countly SDK配置
Countly.sharedInstance().init(countlyConfig);
// java崩溃报告
Countly.sharedInstance().crashes();
// C++ 崩溃报告
// CountlyNative.initNative(applicationContext);
}
}