yx_tracking_point_android/Readme.md

74 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Room 数据持久化Worker管理上传任务初次上传+重试共5次重试间隔10s线性增加多上传任务顺序处理
网络请求 Retrofit
### debug release 区别
| BuildType | 域名 | 是否打印日志 |
|----------|------|--------------|
| debug | http://192.168.2.7:18828 | 是 |
| release | https://track.23544.com | 否 |
### 使用
#### 1.0.8
```kotlin
repositories {
google()
mavenCentral()
maven {
url = uri("https://nexus.23544.com/repository/maven-releases/")
isAllowInsecureProtocol = true
credentials {
username = "admin"
password = "j7EgYb2ejMCt5aYw"
}
}
maven {
url = uri("https://nexus.23544.com/repository/maven-snapshots/")
isAllowInsecureProtocol = true
credentials {
username = "admin"
password = "j7EgYb2ejMCt5aYw"
}
}
}
//测试环境
debugImplementation("com.yuanxuan:tracking_point:x.x.x-SNAPSHOT")
//生产环境
releaseImplementation("com.yuanxuan:tracking_point:x.x.x")
```
```kotlin
/**
* 初始化
*/
TrackingManager.init(
context = this.application,
uploadIntervalMillis = 10.seconds.inWholeMilliseconds, //收集埋点时长
iTrackingPointUserInfo = TrackingPointUserInfoImp(),
systemCode = "999999999", //通过管理平台获取
)
/**
* 实现 ITrackingPointUserInfo 获取 UserInfo 的方法
*/
class TrackingPointUserInfoImp: ITrackingPointUserInfo {
override fun uploadUserInfo(): UserInfo? {
return UserInfo(
userId = 123456,
userName = "username",
account = "account"
) or null
}
}
/**
* 接口文档 http://192.168.2.7:18828/swagger/index.html?urls.primaryName=%E6%95%B0%E6%8D%AE%E5%9F%8B%E7%82%B9%E5%92%8Capi%E6%97%A5%E5%BF%97
* api : api/ExternalEventlogs/AddEventListLog
*/
TrackingManager.push(
eventType = "dianji", //通过管理平台获取
eventParams = EventParams(
buttonId = "${view.id}",
page = "Main",
url = ""
)
)
```