Digital Measurement Android Artifactory Guide
From Engineering Client Portal
The Nielsen AppSDK can either be downloaded directly from the engineering portal, or can be integrated directly within an application through the use of a CocoaPod or Gradle.
How to install the Nielsen AppSDK using Gradle for Android
Below are the steps which needs to be performed by app developers to integrate nielsen app sdk within an android application.
Update grade.properties
The first step is to add the credentials received from Nielsen into your gradle.properties file, generally near the end of the file. We recommend using the version in your home folder (Global Properties). Grade looks for gradle.properties files in this sequence:
gradle.properties
in project root directory.gradle.properties
in GRADLE_USER_HOME directory.- system properties, e.g. when
-Dgradle.user.home
is set on the command line.
Properties from one file will override the properties from the previous ones (so file in gradle user home has precedence over the others, and file in sub-project has precedence over the one in project root).
Reference: https://gradle.org/docs/current/userguide/build_environment.html
machine raw.githubusercontent.com
nielsen_user=<Nielsen App SDK client>
nielsen_authCode=<Auth token>
Your Credentials are:
machine raw.githubusercontent.com
login NielsenSdkRepo
password edec0d01b953171c704188c1d8fc0aa4217ec506
Add Nielsen Maven Repository
Please add the nielsen maven repository inside the repositories section of your app's module build.gradle file like below:
android{
repositories {
//Copy below code inside repository section of app’s build.gradle file
maven { url 'https://raw.githubusercontent.com/NielsenDigitalSDK/nielsenappsdk-android/master/'
credentials {
//Make sure you add nielsen_user and nielsen_passwd with respective nielsen provided
// values to global gradle.properties file
username = project.property("nielsen_user")
password = project.property("nielsen_authCode")
}
authentication {
basic(BasicAuthentication)
}
}
}
}
Add gradle dependency
Please add nielsen app sdk as compile time dependency inside build.gradle file as below
grade 4.x and above
For gradle version starting with 4.x add below line inside dependencies section of build.gradle file.
implementation 'com.nielsenappsdk:${flavour}:${version}'
grade prior to 4.x
For gradle version previous to 4.x add below line inside dependencies section of build.gradle file.
compile 'com.nielsenappsdk:${flavour}:${version}'
Version Control
Please replace ${version} with required nielsen app sdk release version given in below table Please replace ${flavour} with one of below flavour type value
Flavour Type | Description | Version |
---|---|---|
global | For Global Clients (US/AU/TH/CZ) | 6.1.0.1, |
agf | For AGF(EU) Clients | 6.1.0.1 |
vri | based nielsen app sdk clients (Japan) | 6.1.0.1 |
Below is an example for dependency
dependencies { ....
implementation 'com.nielsenappsdk:global:6.1.0.1'
}
Ensuring you have the latest release information
It is recommended to use the most recent version of the NielsenSDK by using the following:
dependencies { ....
implementation 'com.nielsenappsdk:global:+'
}
In addition, please add below gradle task inside your build.gradle (Module:app)
or build.gradle(Project:My-app)
file to fetch latest release details of nielsen app sdk as below:
Please note: The
build.gradle (Module:app)
can overwrite thebuild.gradle(Project:My-app)
.
task NielsenSdkReleaseCheck {
def login_details = project.property("nielsen_user")+":"+project.property("nielsen_authCode")
def p = ['curl', '-u',login_details ,"https://raw.githubusercontent.com/NielsenDigitalSDK/nielsenappsdk-android/master/com/nielsenappsdk/global/NielsenAppSdk-ReadMe.md"].execute().text
project.logger.log(LogLevel.ERROR,p)
}
preBuild.dependsOn('NielsenSdkReleaseCheck')
Sync
If you are finished with all previous steps then you can sync your build.gradle and after successful build you are ready to use nielsen app sdk library in your code.