├── connectionclass ├── .gitignore ├── gradle.properties ├── src │ ├── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── facebook │ │ │ └── network │ │ │ └── connectionclass │ │ │ ├── ConnectionQuality.java │ │ │ ├── ExponentialGeometricAverage.java │ │ │ ├── ByteArrayScanner.java │ │ │ ├── DeviceBandwidthSampler.java │ │ │ └── ConnectionClassManager.java │ └── test │ │ └── java │ │ └── com │ │ └── facebook │ │ └── network │ │ └── connectionclass │ │ └── ConnectionClassTest.java └── build.gradle ├── connectionclass-sample ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── values │ │ │ └── strings.xml │ │ └── layout │ │ │ └── activity_main.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── facebook │ │ └── network │ │ └── connectionclass │ │ └── sample │ │ └── MainActivity.java └── build.gradle ├── gradle.properties ├── settings.gradle ├── .gitignore ├── docs └── images │ ├── logo_trans_square.png │ └── bandwidth_averaging.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── CHANGELOG.md ├── LICENSE ├── CONTRIBUTING.md ├── PATENTS ├── gradlew.bat ├── README.md ├── release.gradle └── gradlew /connectionclass/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /connectionclass-sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | VERSION_NAME=1.0.1 2 | GROUP=com.facebook.network.connectionclass -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':connectionclass-sample' 2 | include ':connectionclass' -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea 4 | *.iml 5 | .DS_Store 6 | /build 7 | -------------------------------------------------------------------------------- /connectionclass/gradle.properties: -------------------------------------------------------------------------------- 1 | POM_NAME=Network Connection Class 2 | POM_ARTIFACT_ID=connectionclass 3 | POM_PACKAGING=aar -------------------------------------------------------------------------------- /docs/images/logo_trans_square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/network-connection-class/HEAD/docs/images/logo_trans_square.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/network-connection-class/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /docs/images/bandwidth_averaging.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/network-connection-class/HEAD/docs/images/bandwidth_averaging.png -------------------------------------------------------------------------------- /connectionclass-sample/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/network-connection-class/HEAD/connectionclass-sample/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /connectionclass-sample/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/network-connection-class/HEAD/connectionclass-sample/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /connectionclass-sample/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/network-connection-class/HEAD/connectionclass-sample/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /connectionclass-sample/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/network-connection-class/HEAD/connectionclass-sample/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Change Log 2 | ========== 3 | 4 | ## Version 1.0.1 5 | 6 | _2015-04-02_ 7 | 8 | * Fixed singleton threading issue. 9 | 10 | ## Version 1.0.0 11 | 12 | _2015-03-25_ 13 | 14 | * Initial release. -------------------------------------------------------------------------------- /connectionclass/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Sep 03 12:41:50 PDT 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip 7 | -------------------------------------------------------------------------------- /connectionclass-sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ConnectionClass Sample 5 | Test Connection 6 | Your connection class is: 7 | 8 | 9 | -------------------------------------------------------------------------------- /connectionclass-sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | repositories { 4 | jcenter() 5 | } 6 | 7 | android { 8 | compileSdkVersion 21 9 | buildToolsVersion "21.1.2" 10 | 11 | defaultConfig { 12 | applicationId "com.facebook.network.connectionclass.sample" 13 | minSdkVersion 9 14 | targetSdkVersion 21 15 | versionCode 1 16 | versionName "1.0" 17 | } 18 | } 19 | 20 | dependencies { 21 | compile project (":connectionclass") 22 | } 23 | -------------------------------------------------------------------------------- /connectionclass/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 21 5 | buildToolsVersion "21.1.2" 6 | 7 | defaultConfig { 8 | minSdkVersion 9 9 | targetSdkVersion 21 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | } 14 | 15 | dependencies { 16 | compile 'com.google.code.findbugs:jsr305:2.0.1' 17 | testCompile 'junit:junit:4.12' 18 | testCompile 'org.mockito:mockito-core:2.0.5-beta' 19 | testCompile 'org.robolectric:robolectric:3.0' 20 | testCompile ('org.powermock:powermock-api-mockito:1.6.2') { 21 | exclude module: 'hamcrest-core' 22 | exclude module: 'objenesis' 23 | } 24 | testCompile ('org.powermock:powermock-module-junit4:1.6.2') { 25 | exclude module: 'hamcrest-core' 26 | exclude module: 'objenesis' 27 | } 28 | } 29 | 30 | apply from: rootProject.file('release.gradle') -------------------------------------------------------------------------------- /connectionclass-sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /connectionclass/src/main/java/com/facebook/network/connectionclass/ConnectionQuality.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | package com.facebook.network.connectionclass; 12 | 13 | /** 14 | * A general enumeration for different connection qualities. 15 | * 16 | *

17 | * In order to compare qualities use the {@link .compareTo()} method. Qualities are ordered in increasing 18 | * order of declaration as per the java docs for {@link java.lang.Enum}. 19 | *

20 | */ 21 | public enum ConnectionQuality { 22 | /** 23 | * Bandwidth under 150 kbps. 24 | */ 25 | POOR, 26 | /** 27 | * Bandwidth between 150 and 550 kbps. 28 | */ 29 | MODERATE, 30 | /** 31 | * Bandwidth between 550 and 2000 kbps. 32 | */ 33 | GOOD, 34 | /** 35 | * EXCELLENT - Bandwidth over 2000 kbps. 36 | */ 37 | EXCELLENT, 38 | /** 39 | * Placeholder for unknown bandwidth. This is the initial value and will stay at this value 40 | * if a bandwidth cannot be accurately found. 41 | */ 42 | UNKNOWN 43 | } 44 | -------------------------------------------------------------------------------- /connectionclass-sample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 |