Difference between revisions of "Digital Measurement Android Artifactory Guide"

From Engineering Client Portal

(Flavor Control)
(Ensuring you have the latest release information)
(4 intermediate revisions by the same user not shown)
Line 72: Line 72:
 
<source lang="java">
 
<source lang="java">
 
dependencies { ....
 
dependencies { ....
implementation 'com.nielsenappsdk:global:+'
+
implementation 'com.nielsenappsdk:globalx:+'
 
}
 
}
 
</source>
 
</source>
Line 79: Line 79:
 
<source lang="java">
 
<source lang="java">
 
dependencies { ....
 
dependencies { ....
implementation 'com.nielsenappsdk:global:7.1.0.0'
+
implementation 'com.nielsenappsdk:globalx:7.1.0.0'
 
}
 
}
 
</source>
 
</source>
Line 92: Line 92:
 
!App Flavor Name !! Description  
 
!App Flavor Name !! Description  
 
|-
 
|-
|com.nielsenappsdk:agf||AGF flavor of appsdk for non androidx apps
+
|com.nielsenappsdk:globalx||GLOBAL flavour of appsdk for androidx apps
 
|-
 
|-
|com.nielsenappsdk:agfx||AGF flavor of appsdk for androidx apps
+
|com.nielsenappsdk:global||GLOBAL flavour of appsdk for non androidx apps
 
|-
 
|-
|com.nielsenappsdk:global||GLOBAL flavor of appsdk for non androidx apps
+
|com.nielsenappsdk:agfx||AGF flavour of appsdk for androidx apps
 
|-
 
|-
|com.nielsenappsdk:globalx||GLOBAL flavor of appsdk for androidx apps
+
|com.nielsenappsdk:agf||AGF flavour of appsdk for non androidx apps
 
|-
 
|-
|com.nielsenappsdk:vri||VRI flavor of appsdk for non androidx apps||
+
|com.nielsenappsdk:vrix||VRI flavour of appsdk for androidx apps||
 
|-
 
|-
|com.nielsenappsdk:vrix||VRI flavor of appsdk for androidx apps||
+
|com.nielsenappsdk:vri||VRI flavour of appsdk for non androidx apps||
 +
 
 
|}
 
|}
 +
  
 
Below is an example for dependency
 
Below is an example for dependency
Line 109: Line 111:
 
<source lang="java">
 
<source lang="java">
 
dependencies { ....
 
dependencies { ....
implementation 'com.nielsenappsdk:global:+'
+
implementation 'com.nielsenappsdk:globalx:+'
 
}
 
}
 
</source>
 
</source>
Line 117: Line 119:
 
<source lang="java">
 
<source lang="java">
 
dependencies { ....
 
dependencies { ....
implementation 'com.nielsenappsdk:global:+'
+
implementation 'com.nielsenappsdk:globalx:+'
 
}
 
}
 
</source>
 
</source>

Revision as of 20:26, 18 May 2020

Engineering Portal breadcrumbArrow.png Digital breadcrumbArrow.png DCR & DTVR 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:${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

It is recommended to use + to ensure you receive the most recent version of the NielsenSDK.

compile 'com.nielsenappsdk:${flavour}:${version}'


and a sample is:

dependencies { ....
implementation 'com.nielsenappsdk:globalx:+'
}


However a specific version can also be requested. To specify a version, please replace ${version} with required Nielsen App SDK release.

dependencies { ....
implementation 'com.nielsenappsdk:globalx:7.1.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.

Flavor Control

To specify a specific flavor of the Nielsen SDK, please replace ${flavor} with one of below flavor types:

App Flavor Name Description
com.nielsenappsdk:globalx GLOBAL flavour of appsdk for androidx apps
com.nielsenappsdk:global GLOBAL flavour of appsdk for non androidx apps
com.nielsenappsdk:agfx AGF flavour of appsdk for androidx apps
com.nielsenappsdk:agf AGF flavour of appsdk for non androidx apps
com.nielsenappsdk:vrix VRI flavour of appsdk for androidx apps
com.nielsenappsdk:vri VRI flavour of appsdk for non androidx apps


Below is an example for dependency

dependencies { ....
implementation 'com.nielsenappsdk:globalx:+'
}

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:globalx:+'
}


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

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.