Digital Measurement Android Artifactory Guide: Difference between revisions
From Engineering Client Portal
ColinBrown (talk | contribs) |
AnkitAgrawal (talk | contribs) No edit summary |
||
(25 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Breadcrumb|}} {{Breadcrumb|Digital}} {{Breadcrumb|Digital Downloads}} {{CurrentBreadcrumb}} | {{Breadcrumb|}} {{Breadcrumb|Digital}} {{Breadcrumb|Digital Downloads}} {{CurrentBreadcrumb}} | ||
[[Category:Digital]] | [[Category:Digital]] | ||
__NOTOC__ | __NOTOC__ | ||
The Nielsen AppSDK can either be downloaded directly from the [http://engineeringportal.nielsen.com Engineering Portal], or can be integrated directly within an application through the use of a CocoaPod or Gradle. | The Nielsen AppSDK can either be downloaded directly from the [http://engineeringportal.nielsen.com Engineering Portal], or can be integrated directly within an application through the use of a CocoaPod or Gradle. | ||
Line 7: | Line 6: | ||
= How to install the Nielsen AppSDK using Gradle for Android = | = How to install the Nielsen AppSDK using Gradle for Android = | ||
Below are the steps which need to be performed by app developers to integrate the Nielsen App SDK within an Android application. | Below are the steps which need to be performed by app developers to integrate the Nielsen App SDK within an Android application. | ||
== Add Nielsen Maven Repository == | == Add Nielsen Maven Repository == | ||
Please add the Nielsen maven repository inside the repositories section of your app's module build.gradle file like below: | Please add the Nielsen maven repository inside the repositories section of your app's module build.gradle file like below: | ||
<br> | |||
<source lang=" | <source lang="android"> | ||
repositories { | repositories { | ||
//Copy below code inside repository section of app’s build.gradle file | //Copy below code inside repository section of app’s build.gradle file | ||
maven { url 'https://raw.githubusercontent.com/NielsenDigitalSDK/nielsenappsdk-android/master/' | maven { url 'https://raw.githubusercontent.com/NielsenDigitalSDK/nielsenappsdk-android/master/' | ||
} | |||
</source> | </source> | ||
<br> | |||
<blockquote> | |||
[[Image:AlertIcon.png|left|60px|link=|class=smallIcon]] Starting on Sept 21, 2021 the Nielsen SDK has moved to a public repository. Credentials are no longer required. | |||
</blockquote> | |||
<br> | |||
== Add gradle dependency == | == Add gradle dependency == | ||
Line 54: | Line 28: | ||
=== grade 4.x and above === | === grade 4.x and above === | ||
For gradle version starting with 4.x add the following line inside dependencies section of build.gradle file.<br> | For gradle version starting with 4.x add the following line inside dependencies section of build.gradle file.<br> | ||
<source lang=" | <source lang="html">implementation 'com.nielsenappsdk.${market}:${flavor}:${version}'</source> | ||
<br> | <br> | ||
<source lang=" | <source lang="html"> | ||
dependencies { .... | dependencies { .... | ||
implementation 'com.nielsenappsdk: | implementation 'com.nielsenappsdk.global:ad:+' // Using + will provide the latest version | ||
} | } | ||
</source> | </source> | ||
Line 64: | Line 38: | ||
=== grade prior to 4.x === | === grade prior to 4.x === | ||
For gradle version previous to 4.x add below line inside dependencies section of build.gradle file. | For gradle version previous to 4.x add below line inside dependencies section of build.gradle file. | ||
<source lang=" | <source lang="html">compile 'com.nielsenappsdk.${market}:${flavor}:${version}'</source> | ||
<br> | <br> | ||
<source lang=" | <source lang="html"> | ||
dependencies { .... | dependencies { .... | ||
compile 'com.nielsenappsdk: | compile 'com.nielsenappsdk.global:ad:+' // Using + will provide the latest version | ||
} | } | ||
</source> | </source> | ||
Line 74: | Line 48: | ||
== Version and Flavor Control == | == Version and Flavor Control == | ||
With version 8.1.0.0+ of the Nielsen appSDK, it is possible to request a specific '''${flavor}''' that reads the '''Google Ad ID''', '''Android ID''', or is '''Kid app''' friendly (noID). For example:<br> | With version 8.1.0.0+ of the Nielsen appSDK, it is possible to request a specific '''${flavor}''' that reads the '''Google Ad ID''', '''Android ID''', or is '''Kid app''' friendly (noID). For example:<br> | ||
<source lang=" | <source lang="html">implementation 'com.nielsenappsdk.${market}:${flavor}:${version}'</source> | ||
* if the flavor selected is equal to <code>ad</code> the Nielsen SDK will try to obtain the googleAdID if the user has not opted out. | * if the flavor selected is equal to <code>ad</code> the Nielsen SDK will try to obtain the googleAdID if the user has not opted out. | ||
* If the flavor is <code>noad</code> then the Nielsen SDK will attempt to obtain the AndroidID. | * If the flavor is <code>noad</code> then the Nielsen SDK will attempt to obtain the AndroidID. | ||
* If the flavor selected is <code>noid</code> then the Nielsen SDK will not request any identifier which is required for many kid apps. | * If the flavor selected is <code>noid</code> then the Nielsen SDK will not request any identifier which is required for many kid apps. | ||
<blockquote>To ensure backward | <blockquote>To ensure backward compatability, <code> implementation 'com.nielsenappsdk:${market}:${version}'</code> will continue to be supported.</blockquote> | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 103: | Line 77: | ||
== Ensuring you have the latest release information == | == Ensuring you have the latest release information == | ||
It is recommended to use <code>+</code> for <code>${version}</code> to ensure you receive the most recent version of the NielsenSDK.<br> | It is recommended to use <code>+</code> for <code>${version}</code> to ensure you receive the most recent version of the NielsenSDK; however, if you are specifying the exact version of the SDK, please use only the first 3 digits. EG: 8.1.0<br> | ||
A sample if using AppSDK 8.1.0.0 + would be: | A sample if using AppSDK 8.1.0.0 + would be: | ||
<source lang=" | <source lang="html"> | ||
dependencies { .... | dependencies { .... | ||
implementation 'com.nielsenappsdk | implementation 'com.nielsenappsdk.global:ad:+' | ||
} | } | ||
</source> | </source> | ||
<br> | <br> | ||
If using AppSDK 7 to 8.0.0.0 | If using AppSDK 7 to 8.0.0.0 | ||
<source lang=" | <source lang="html"> | ||
dependencies { .... | dependencies { .... | ||
implementation 'com.nielsenappsdk:globalx:8 | implementation 'com.nielsenappsdk:globalx:8.0.0' | ||
} | } | ||
</source> | </source> | ||
Line 125: | Line 99: | ||
<source lang="java">task NielsenSdkReleaseCheck { | <source lang="java">task NielsenSdkReleaseCheck { | ||
def p = ['curl',"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')</source> | preBuild.dependsOn('NielsenSdkReleaseCheck') | ||
</source> | |||
=== App Suffix Reference === | === App Suffix Reference === | ||
The Nielsen AppSDK has various configurations per market and distribution type, which can be determined by reviewing the [[Digital Measurement Android Suffix Guide|sdk suffix]]. The first part will be the SDK version: 3 digits for the major SDK version and 1 digit for the minor SDK version. EG: <code>aa.8.1.0.0_abc</code> | The Nielsen AppSDK has various configurations per market and distribution type, which can be determined by reviewing the [[Digital Measurement Android Suffix Guide|sdk suffix]]. The first part will be the SDK version: 3 digits for the major SDK version and 1 digit for the minor SDK version. EG: <code>aa.8.1.0.0_abc</code> | ||
== Proguard Obfuscation == | |||
AppSDK internally obfuscate all non-public classes during the build process using Proguard. Please use the below filter to avoid further obfuscation of AppSDK classes if Client app is also using proguard tool | |||
"''-keep class com.nielsen.app.sdk.** { *; }''" | |||
== Sync == | == Sync == | ||
Line 141: | Line 123: | ||
The below is an example of a very basic app build.gradle file | The below is an example of a very basic app build.gradle file | ||
<syntaxhighlight lang=Java> | <syntaxhighlight lang=Java> | ||
plugins { | |||
id 'com.android.application' | |||
} | |||
android { | android { | ||
compileSdkVersion | compileSdkVersion 30 | ||
buildToolsVersion "30.0.3" | |||
defaultConfig { | defaultConfig { | ||
applicationId "com.nielsen. | applicationId "com.nielsen.simplestandardandroidart" | ||
minSdkVersion 23 | minSdkVersion 23 | ||
targetSdkVersion | targetSdkVersion 30 | ||
versionCode 1 | versionCode 1 | ||
versionName "1.0" | versionName "1.0" | ||
Line 165: | Line 150: | ||
//Copy below code inside repository section of app’s build.gradle file | //Copy below code inside repository section of app’s build.gradle file | ||
maven { url 'https://raw.githubusercontent.com/NielsenDigitalSDK/nielsenappsdk-android/master/' | maven { url 'https://raw.githubusercontent.com/NielsenDigitalSDK/nielsenappsdk-android/master/' | ||
} | } | ||
} | |||
compileOptions { | |||
sourceCompatibility JavaVersion.VERSION_1_8 | |||
targetCompatibility JavaVersion.VERSION_1_8 | |||
} | } | ||
} | |||
dependencies { | |||
implementation 'androidx.appcompat:appcompat:1.2.0' | |||
implementation 'com.google.android.material:material:1.1.0' | |||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4' | |||
testImplementation 'junit:junit:4.+' | |||
androidTestImplementation 'androidx.test.ext:junit:1.1.2' | |||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' | |||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' | |||
implementation 'com.google.android.gms:play-services-ads:20.3.0' | |||
implementation 'com.nielsenappsdk.global:ad:+' | |||
} | } | ||
task NielsenSdkReleaseCheck { | task NielsenSdkReleaseCheck { | ||
def p = ['curl',"https://raw.githubusercontent.com/NielsenDigitalSDK/" + | |||
def p = ['curl' | "nielsenappsdk-android/master/com/nielsenappsdk/global/" + | ||
android/master/com/nielsenappsdk/global/NielsenAppSdk-ReadMe.md"].execute().text | "NielsenAppSdk-ReadMe.md"].execute().text | ||
project.logger.log(LogLevel.ERROR,p) | project.logger.log(LogLevel.ERROR,p) | ||
} | } | ||
preBuild.dependsOn('NielsenSdkReleaseCheck') | preBuild.dependsOn('NielsenSdkReleaseCheck') | ||
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 16:48, 2 December 2024
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 need to be performed by app developers to integrate the Nielsen App SDK within an Android application.
Add Nielsen Maven Repository
Please add the Nielsen maven repository inside the repositories section of your app's module build.gradle file like below:
repositories {
//Copy below code inside repository section of app’s build.gradle file
maven { url 'https://raw.githubusercontent.com/NielsenDigitalSDK/nielsenappsdk-android/master/'
}
Starting on Sept 21, 2021 the Nielsen SDK has moved to a public repository. Credentials are no longer required.
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 the following line inside dependencies section of build.gradle file.
implementation 'com.nielsenappsdk.${market}:${flavor}:${version}'
dependencies { ....
implementation 'com.nielsenappsdk.global:ad:+' // Using + will provide the latest 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.${market}:${flavor}:${version}'
dependencies { ....
compile 'com.nielsenappsdk.global:ad:+' // Using + will provide the latest version
}
Version and Flavor Control
With version 8.1.0.0+ of the Nielsen appSDK, it is possible to request a specific ${flavor} that reads the Google Ad ID, Android ID, or is Kid app friendly (noID). For example:
implementation 'com.nielsenappsdk.${market}:${flavor}:${version}'
- if the flavor selected is equal to
ad
the Nielsen SDK will try to obtain the googleAdID if the user has not opted out. - If the flavor is
noad
then the Nielsen SDK will attempt to obtain the AndroidID. - If the flavor selected is
noid
then the Nielsen SDK will not request any identifier which is required for many kid apps.
To ensure backward compatability,
implementation 'com.nielsenappsdk:${market}:${version}'
will continue to be supported.
SDK Version | ${market} | ${flavor} | ${version} | Examples |
---|---|---|---|---|
Appsdk 8.1.0.0+ | global agf
|
ad noad noid
|
+ is most recent version8.1.0.0
|
'com.nielsenappsdk.global:ad:+'
|
AppSDK 7 to 8.0.0.0 | globalx global agf agfx
|
not used | + is most recent version7.1.0.0 8.0.0.0
|
'com.nielsenappsdk:globalx:+' |
If using version control, a warning message will be displayed within the console trace during the build of your app, and it will show all sdk versions released to-date, allowing a developer to select a more recent build if desired.
Starting with Version 8.x, the Nielsen SDK will only support Androidx.
Ensuring you have the latest release information
It is recommended to use +
for ${version}
to ensure you receive the most recent version of the NielsenSDK; however, if you are specifying the exact version of the SDK, please use only the first 3 digits. EG: 8.1.0
A sample if using AppSDK 8.1.0.0 + would be:
dependencies { ....
implementation 'com.nielsenappsdk.global:ad:+'
}
If using AppSDK 7 to 8.0.0.0
dependencies { ....
implementation 'com.nielsenappsdk:globalx:8.0.0'
}
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 p = ['curl',"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')
App Suffix Reference
The Nielsen AppSDK has various configurations per market and distribution type, which can be determined by reviewing the sdk suffix. The first part will be the SDK version: 3 digits for the major SDK version and 1 digit for the minor SDK version. EG: aa.8.1.0.0_abc
Proguard Obfuscation
AppSDK internally obfuscate all non-public classes during the build process using Proguard. Please use the below filter to avoid further obfuscation of AppSDK classes if Client app is also using proguard tool
"-keep class com.nielsen.app.sdk.** { *; }"
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.
Sample file
The below is an example of a very basic app build.gradle file
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.nielsen.simplestandardandroidart"
minSdkVersion 23
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
repositories {
//Copy below code inside repository section of app’s build.gradle file
maven { url 'https://raw.githubusercontent.com/NielsenDigitalSDK/nielsenappsdk-android/master/'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'com.google.android.gms:play-services-ads:20.3.0'
implementation 'com.nielsenappsdk.global:ad:+'
}
task NielsenSdkReleaseCheck {
def p = ['curl',"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')