Difference between revisions of "Digital Measurement Android Artifactory Guide"

From Engineering Client Portal

(Version Control)
Line 1: Line 1:
{{Breadcrumb|}} {{Breadcrumb|Digital}} {{Breadcrumb|DCR & DTVR}} {{CurrentBreadcrumb}}
+
{{Breadcrumb|}} {{Breadcrumb|Digital}} {{Breadcrumb|Downloads}} {{CurrentBreadcrumb}}
 
[[Category:Digital]]
 
[[Category:Digital]]
  
Line 46: Line 46:
 
   authentication {
 
   authentication {
 
       basic(BasicAuthentication)
 
       basic(BasicAuthentication)
   }
+
   }}}}
}
+
</source>
}
 
 
 
}</source>
 
  
 
== Add gradle dependency ==
 
== Add gradle dependency ==
Line 56: Line 53:
 
Please add Nielsen app SDK as compile time dependency inside build.gradle file as below
 
Please add Nielsen app SDK as compile time dependency inside build.gradle file as below
 
=== 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.
+
For gradle version starting with 4.x add the following line inside dependencies section of build.gradle file.<br>
 
+
<source lang="java">implementation 'com.nielsenappsdk:${market}:${version}'</source>
<source lang="java">implementation 'com.nielsenappsdk:${flavour}:${version}'</source>
 
 
 
=== grade prior to 4.x ===
 
For gradle version previous to 4.x add below line inside dependencies section of build.gradle file.
 
 
 
<source lang="java">compile 'com.nielsenappsdk:${flavour}:${version}'</source>
 
 
 
== Version Control ==
 
It is recommended to use <code> + </code> to ensure you receive the most recent version of the NielsenSDK.
 
<source lang="java">compile 'com.nielsenappsdk:${flavour}:${version}'</source>
 
 
<br>
 
<br>
and a sample is:
 
 
<source lang="java">
 
<source lang="java">
 
dependencies { ....
 
dependencies { ....
implementation 'com.nielsenappsdk:globalx:+'
+
implementation 'com.nielsenappsdk:globalx:+' // Using + will provide the latest version
 
}
 
}
 
</source>
 
</source>
 +
 +
=== grade prior to 4.x ===
 +
For gradle version previous to 4.x add below line inside dependencies section of build.gradle file.
 +
<source lang="java">compile 'com.nielsenappsdk:${market}:${version}'</source>
 
<br>
 
<br>
However a specific version can also be requested.  To specify a version, please replace <code>${version}</code> with required Nielsen App SDK release.
 
 
<source lang="java">
 
<source lang="java">
 
dependencies { ....
 
dependencies { ....
implementation 'com.nielsenappsdk:globalx:8.1.0.0'
+
compile 'com.nielsenappsdk:globalx:+' // Using + will provide the latest version
 
}
 
}
 
</source>
 
</source>
<br>
 
<blockquote>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.</blockquote>
 
  
== Flavor Control ==
+
== Version and Flavor Control ==
To specify a specific flavor of the Nielsen SDK, please replace <code>${flavor}</code> with one of below flavor types:
+
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>
{| class="wikitable"
+
<source lang="java">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.
!App Flavor Name !! Description !!
+
* 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.
 +
<blockquote>To ensure backward compatability, <code> implementation 'com.nielsenappsdk:${market}:${version}'</code> will continue to be supported.</blockquote>
 +
{| class="wikitable"  
 
|-
 
|-
|com.nielsenappsdk:globalx||GLOBAL flavor of appsdk for androidx apps|| Recommended
+
! SDK  Version
 +
! ${market}
 +
! ${flavor}
 +
! ${version}
 +
! Examples
 
|-
 
|-
|com.nielsenappsdk:global||GLOBAL flavor of appsdk for non androidx apps||
+
| Appsdk 8.1.0.0+
 +
|<code>global</code><br /><code>agf</code>
 +
|<code>ad</code><br /><code>noad</code><br /><code>noid</code>
 +
| + is most recent version<br /><code>8.1.0.0</code>
 +
|<code>'com.nielsenappsdk:global:ad:+'<br />'com.nielsenappsdk:global:noad:+'<br />'com.nielsenappsdk:global:noad:8.1.0.0'</code>
 
|-
 
|-
|com.nielsenappsdk:agfx||AGF flavor of appsdk for androidx apps|| Recommended
+
| AppSDK 7 to 8.0.0.0
|-
+
|<code>globalx</code><br /><code>global</code><br /><code>agf</code><br /><code>agfx</code>
|com.nielsenappsdk:agf||AGF flavor of appsdk for non androidx apps||
+
|not used
 
+
| + is most recent version<br /><code>7.1.0.0</code><br /><code>8.0.0.0</code>
 +
|<code>'com.nielsenappsdk:globalx:+'<br />'com.nielsenappsdk:global:8.0.0.0'<br />'com.nielsenappsdk:agf:8.0.0.0'</code><br /><br />
 
|}
 
|}
 +
<blockquote>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. </blockquote> Starting with Version 8.x, the Nielsen SDK will only support Androidx.
  
<blockquote>Starting with Version 8.x, the Nielsen SDK will only support Androidx. If <code>com.nielsenappsdk:global</code> is requested, you will be provided with <code>com.nielsenappsdk:globalx </code>. It is recommended to use Androidx version whenever possible. </blockquote>
+
== Ensuring you have the latest release information ==
<br>
+
It is recommended to use <code>+</code> for <code>${version}</code> to ensure you receive the most recent version of the NielsenSDK.<br>
Below is an example for dependency
 
  
 +
A sample if using AppSDK 8.1.0.0 + would be:
 
<source lang="java">
 
<source lang="java">
 
dependencies { ....
 
dependencies { ....
implementation 'com.nielsenappsdk:globalx:+'
+
implementation 'com.nielsenappsdk:global:ad:+'
 
}
 
}
 
</source>
 
</source>
 
+
<br>
== Ensuring you have the latest release information ==
+
If using AppSDK 7 to 8.0.0.0
It is recommended to use the most recent version of the NielsenSDK by using the following:
 
 
<source lang="java">
 
<source lang="java">
 
dependencies { ....
 
dependencies { ....
implementation 'com.nielsenappsdk:globalx:+'
+
implementation 'com.nielsenappsdk:globalx:8.0.0.0'
 
}
 
}
 
</source>
 
</source>
Line 189: Line 188:
 
dependencies {
 
dependencies {
 
     implementation fileTree(include: ['*.jar'], dir: 'libs')
 
     implementation fileTree(include: ['*.jar'], dir: 'libs')
     implementation 'com.nielsenappsdk:globalx:7.2.0.0'
+
     implementation 'com.nielsenappsdk:global:ad:+' // Requesting the global, standard, most recent version
 
     implementation 'androidx.appcompat:appcompat:1.1.0'
 
     implementation 'androidx.appcompat:appcompat:1.1.0'
 
     implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
 
     implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

Revision as of 23:43, 1 July 2021

Engineering Portal breadcrumbArrow.png Digital breadcrumbArrow.png Downloads breadcrumbArrow.png Digital Measurement Android Artifactory Guide


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.

Update grade.properties

The first step is to add the credentials received from Nielsen into your gradle.properties file, typically near the end of the file. We recommend using the version in your home folder (Global Properties). Gradle 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>


AlertIcon.png

Please do not upload any file to github or bitbucket containing the credentials above.

This will automatically lock your access.

Credentials

Obtain credentials → here ←

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 the following line inside dependencies section of build.gradle file.

implementation 'com.nielsenappsdk:${market}:${version}'


dependencies { ....
implementation 'com.nielsenappsdk:globalx:+'  // 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}:${version}'


dependencies { ....
compile 'com.nielsenappsdk:globalx:+'  // 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 version
8.1.0.0
'com.nielsenappsdk:global:ad:+'
'com.nielsenappsdk:global:noad:+'
'com.nielsenappsdk:global:noad:8.1.0.0'
AppSDK 7 to 8.0.0.0 globalx
global
agf
agfx
not used + is most recent version
7.1.0.0
8.0.0.0
'com.nielsenappsdk:globalx:+'
'com.nielsenappsdk:global:8.0.0.0'
'com.nielsenappsdk:agf:8.0.0.0'


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.

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.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 the build.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')

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

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

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29

    defaultConfig {
        applicationId "com.nielsen.android_bsdk_app"
        minSdkVersion 23
        targetSdkVersion 29
        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/'
            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)
            }
        }
    }
}

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')

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.nielsenappsdk:global:ad:+'  // Requesting the global, standard, most recent version
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    implementation 'com.google.android.gms:play-services:+'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
    implementation 'com.android.support:multidex:1.0.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

}