Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 58 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
自定义统计SDK, 完全放弃第三方平台,让app拥有自主的数据统计功能
>支持页面统计
>自定义事件统计
>APP启动退出统计,不同渠道统计
>APP启动退出统计,crsah日志统计



Expand Down Expand Up @@ -84,12 +84,12 @@ APP常规数据统计


设置上报策略的代码示例如下:
// 设置策略模式 第一个是策略模式 ,第二是是时间(单位/分)

// 设置策略模式 第一个是策略模式 ,第二是是时间(单位/分)
TcStatInterface.setUploadPolicy(TcStatInterface.UploadPolicy.UPLOAD_POLICY_INTERVA, 3);







API说明
Expand All @@ -99,7 +99,8 @@ API说明
请具体看demo 注释

5. 集成步骤
4.1 依赖项目

5.1 依赖项目

gradle中配置依赖module, 将项目增加为自己的子模块

Expand All @@ -109,26 +110,71 @@ API说明
compile project(':StatInterface')
}

4.2 配置Settings.gradle
5.2 配置Settings.gradle

include ':app' ,':StatInterface'

4.3 加入权限
5.3 加入权限

见2.1的说明。
4.4 初始化
5.4 初始化

Application的onCreate():

// assets
String fileName = "stat_id.json";

String url = "http://www.baidu.com";
// init statSdk
TcStatInterface.initialize(this, appId, "you app chanel", fileName);
// set upload url
TcStatInterface.setUrl(url);

见2.3说明 具体见demo

4.5 其他
5.5 其他

如果你还在用Eclispe,直接用源码或者依赖jar
TcStatSdk_1.0.jar

TcStatSdk_2.0.jar

5.6 调用



findViewById(R.id.id_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TcStatInterface.onEvent("main", "onlick", "send data");
//发送数据
TcStatInterface.reportData();

}

});

findViewById(R.id.id_button2).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

// 测试
TcStatInterface.onEventParameter("onclick", "open next");

Intent intent = new Intent(MainActivity.this, SecondActivity.class);
startActivity(intent);

}

});

注意
--
目前服务端代码需要你自我实现,数据结结构按客户端数据Modle实现即可。

目前服务端代码需要你自我实现,数据结结构按客户端数据Model实现即可。



> 作者:Tamic : http://www.jianshu.com/p/cd83e81b78aa

> 统计数据存储前期:Zhangliang
> crash日志:NULL

106 changes: 100 additions & 6 deletions StatInterface/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

version = "2.4"
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
compileSdkVersion 26
buildToolsVersion '26.0.2'

defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
targetSdkVersion 26
versionCode 4
versionName version
}
buildTypes {
release {
Expand All @@ -20,7 +23,98 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'de.greenrobot:greendao:2.1.0'
compile 'com.alibaba:fastjson:1.2.8+'
compile 'com.loopj.android:android-async-http:1.4.9'
}

def siteUrl = 'https://github.com/NeglectedByBoss/TcStatInterface'
def gitUrl = 'https://github.com/NeglectedByBoss/TcStatInterface.git'
group = "com.tamic"

install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'
// Add your description here
name 'TcStat'
url siteUrl
// Set your license
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'tamic'
name 'tamic'
email 'skay5200@163.com'
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
}

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())


bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")
configurations = ['archives']
pkg {
repo = "maven"
name = "TcStat"
desc = "App 多维度统计库"
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = ["Apache-2.0"]
labels = ['android']
publish = true
publicDownloadNumbers = true
}
}


javadoc {
options{
encoding "UTF-8"
charSet 'UTF-8'
author true
version true
links "http://docs.oracle.com/javase/7/docs/api"
}
}

tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('encoding', 'UTF-8')
options.addStringOption('charSet', 'UTF-8')
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion StatInterface/build/intermediates/bundles/debug/R.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
int string app_name 0x7f020000
int string app_name 0x7f150001
Loading