Template

Difference between revisions of "Android Setting Up Development Environment"

From Engineering Client Portal

(Created page with "== Setting up your Development Environment == === Configuring Android Development Environment === *The Nielsen App SDK (located in the [https://engineeringportal.nielsen.com...")
 
(Google Play Services)
Line 20: Line 20:
 
Steps: Android Studio -> File -> Project Structure ->(In module selection) select App -> Dependencies (tab) -> Click "+" button and search for <code>"*play-services*"</code>.  Then select the most recent version of the play-services Artifact.
 
Steps: Android Studio -> File -> Project Structure ->(In module selection) select App -> Dependencies (tab) -> Click "+" button and search for <code>"*play-services*"</code>.  Then select the most recent version of the play-services Artifact.
 
Ensure it is added in build.gradle (App level) file
 
Ensure it is added in build.gradle (App level) file
 +
 +
==== Google AD ID Permissions ====
 +
The following is required if target API level is set to 31 (Android 12) with the Ad Version of the Nielsen SDK.
 +
 +
<syntaxhighlight lang="java">
 +
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
 +
</syntaxhighlight>
 +
</br>
  
 
==== Manifest File ====  
 
==== Manifest File ====  

Revision as of 06:13, 18 March 2022

Setting up your Development Environment

Configuring Android Development Environment

  • The Nielsen App SDK (located in the Downloads section of the website) class is the primary application interface to the Nielsen App SDK on Android.
  • The Nielsen App SDK class is defined as the only public class belonging to the com.nielsen.app.sdk package.
  • The Nielsen App SDK can also be added via Artifact Repository.

Nielsen App SDK is compatible with Android OS versions 2.3+. Clients can control / configure the protocol to be used – HTTPS or HTTP to suit their needs.

The requirement for the Java AppSdk.jar library and the libAppSdk.so native library will depend on the type of host application that will make use of them.

  • For Video player applications
    • The Android OS hosting the App SDK should use a media player supporting HLS streaming (Android 3.0 and later will support it natively).
    • If the player application uses a 3rd party media player implementing its own HLS, then the minimum Android version will be limited to version 2.3, since the SDK depends on Google Play support to work properly.

Once SDK is downloaded ensure to unzip the Nielsen SDK and copy the AppSdk.jar in your app (Android Studio) libs folder, then right click the AppSdk.jar and select Add As Library. Ensure the AppSdk.jar file is added in 'build.grade (App Level) file.

  • App SDK 1.2 provides support for x86, mips, and armeabi-7a architecture.

Google Play Services

Add the Google Play Services in the project, Steps: Android Studio -> File -> Project Structure ->(In module selection) select App -> Dependencies (tab) -> Click "+" button and search for "*play-services*". Then select the most recent version of the play-services Artifact. Ensure it is added in build.gradle (App level) file

The following is required if target API level is set to 31 (Android 12) with the Ad Version of the Nielsen SDK.

<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>


Manifest File

  • Add the following permissions on the project’s AndroidManifest.xml file.
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>

For more details to handle runtime permissions in Android versions, please visit [1].

  • In AndroidManifest.xml under <application> node add the following metadata
<meta-data 
android:name="com.google.android.gms.version" 
android:value="@integer/google_play_services_version"/>
  • App SDK checks to see if there is a Google service available and updated.
  • If not available or updated, App SDK will not use this service when executing its functions and will make reference to missing imports and the app will not be compiled.

Library

Nielsen App SDK uses the following packages/classes from the Google Play service.

  • google-play-services_lib

Classes/package

  • com.google.android.gms.ads.identifier.AdvertisingIdClient;
  • com.google.android.gms.ads.identifier.AdvertisingIdClient.Info;
  • com.google.android.gms.common.ConnectionResult;
  • com.google.android.gms.common.GooglePlayServicesUtil;
  • com.google.android.gms.common.GooglePlayServicesRepairableException;
  • com.google.android.gms.common.GooglePlayServicesNotAvailableException;