Skip to content

Commit

Permalink
release 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zoonooz committed Sep 16, 2018
1 parent 941c20e commit 98cc4e2
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 34 deletions.
84 changes: 58 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,58 @@
CallStats for Android (WIP)
===========================
Callstats WebRTC analytic library for Android

## Demo
The project contains demo application which connect to https://demo.callstats.io

## TODO

- [x] Authentication
- [x] User Action Events
- [x] Fabric Events
- [x] Stats submission
- [x] ICE Events
- [x] Media Events
- [x] Device Events
- [x] Special Events
- [x] Callstats Internal Events
- [x] csioAvgRtt
- [x] csioAvgJitter
- [x] csioAvgBRKbps
- [x] csioIntMs
- [x] csioTimeElapseMs
- [x] csioIntBRKbps
- [x] csioIntFL
- [x] csioIntPktLoss
CallStats for Android
=====================

[![jcenter](https://api.bintray.com/packages/callstats-io/maven/callstats/images/download.svg)](https://bintray.com/callstats-io/maven/callstats/_latestVersion)

[Callstats](https://www.callstats.io/) WebRTC analytic library for Android.

## Getting started
### Gradle dependency

```
implementation "io.callstats:callstats:<version>"
```

Library will requires WebRTC library to be available at runtime.
```
implementation "org.webrtc:google-webrtc:<version>"
```
For more information https://webrtc.org/native-code/android/

### Create Callstats object
```kotlin
callstats = Callstats(
context,
appID, // Application ID from Callstats
localID, // current user ID
deviceID, // unique device ID
jwt, // jwt from server for authentication
alias) // (Optional) user alias
```

### Send events
When starting the call, call `startSession` with room identifier
```kotlin
callstats.startSession(room)
```

These events need to be forwarded to the library in order to start tracking the call. Add followings into your WebRTC `PeerConnection.Observer` For example:
```kotlin
override fun onIceConnectionChange(state: PeerConnection.IceConnectionState) {
callstats.reportEvent(peerId, OnIceConnectionChange(state))
}

override fun onIceGatheringChange(state: PeerConnection.IceGatheringState) {
callstats.reportEvent(peerId, OnIceGatheringChange(state))
}

override fun onSignalingChange(state: PeerConnection.SignalingState) {
callstats.reportEvent(peerId, OnSignalingChange(state))
}
```

And when call finished
``` kotlin
callstats.stopSession()
```

You can take a look at how to send more events in demo application.
19 changes: 16 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion compileSdk

defaultConfig {
applicationId "io.callstats.demo"
minSdkVersion minSdk
targetSdkVersion targetSdk
versionCode 1
versionName "1.0"
versionCode versionCode
versionName versionName
}

buildTypes {
release {
minifyEnabled false
Expand All @@ -26,11 +28,16 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}

lintOptions {
abortOnError false
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':library')

implementation useRemoteLib() ? "io.callstats:callstats:$versionName" : project(':library')

implementation "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlinVersion"
implementation "com.android.support:appcompat-v7:$supportVersion"
Expand All @@ -46,3 +53,9 @@ dependencies {

testImplementation "junit:junit:$junitVersion"
}

boolean useRemoteLib() {
def properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
return Boolean.valueOf(properties.getProperty('useRemoteLib') ?: false)
}
8 changes: 5 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

buildscript {
ext {
versionName = '0.1.0'
versionCode = 1
minSdk = 21
targetSdk = 27
compileSdk = 27
Expand All @@ -21,19 +23,19 @@ buildscript {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.novoda:bintray-release:0.8.1'
}
}

allprojects {
repositories {
google()
jcenter()
maven { url 'https://dl.bintray.com/callstats-io/maven' }
}
}

Expand Down
15 changes: 13 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'com.novoda.bintray-release'

android {
compileSdkVersion compileSdk

defaultConfig {
minSdkVersion minSdk
targetSdkVersion targetSdk
versionCode 1
versionName "1.0"
versionCode versionCode
versionName versionName
}

buildTypes {
Expand All @@ -32,3 +33,13 @@ dependencies {
testImplementation "com.squareup.okhttp3:mockwebserver:$okhttpVersion"
testImplementation "org.webrtc:google-webrtc:$webRtcVersion"
}

publish {
userOrg = 'callstats-io'
groupId = 'io.callstats'
artifactId = 'callstats'
desc = 'callstats.io Android Library'
publishVersion = versionName
}

tasks.withType(Javadoc).all { enabled = false }

0 comments on commit 98cc4e2

Please sign in to comment.