This sample demonstrates how to connect to the network and fetch raw HTML using HttpURLConnection. AsyncTask is used to perform the fetch on a background thread.
New Relic is also installed along with the AWS Device Farm for automated testing.
- Android SDK v23
- Android Build Tools v24.0.0 rc3
- Android Support Repository
- TravisCI account
- New Relic Account
- Amazon Web Services Account
This sample uses the Gradle build system. To build this project, use the "gradlew build" command or use "Import Project" in Android Studio.
The AWS Command-line interface (CLI) is required.
sh $ aws devicefarm create-project --name NetworkConnect
Set projectName
to the name of the Device Farm project that was creating using the CLI.
// Merge this with existing build.gradle
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.amazonaws:aws-devicefarm-gradle-plugin:1.0'
}
}
apply plugin: 'devicefarm'
devicefarm {
// The project must already exist!
projectName "NetworkConnect"
authentication {
accessKey System.env.AWS_ACCESS_KEY_ID
secretKey System.env.AWS_SECRET_ACCESS_KEY
}
appexplorer {}
}
Build flavors are used to send test data to another New Relic application (and not pollute production data with testing):
productFlavors {
prod {
buildConfigField "String", "NEWRELIC_TOKEN", "\"AA86306d05a11be432d9edc83985f86c8e1656bb38\""
}
zPref {
buildConfigField "String", "NEWRELIC_TOKEN", "\"AA3bb1c6bf2fb0ed555cd7f7149dc9e83d7032343a\""
}
}
./gradlew devicefarmUpload