Set the Username with the Aternity Android SDK (setUsername)

You can set a username for a mobile app in Aternity Mobile SDK to be consistent with desktops and laptops, so you can track this user's experience across all devices and platforms.In Android, you can set the username of the application at initialization, or separately using the setUsername method from the Aternity class.

Example of usernames for mobile devices displayed in the dashboards

The Aternity class provides the getInstance method which returns a singleton object. You should call the class's methods using the singleton object, to avoid manually creating and maintaining the Aternity object.

Tip

To monitor the wait times and usage times to display the UXI, you must also wrap the app.

Before You Begin

Before embedding Aternity's monitoring into an Android mobile app, verify your device conforms to the following minimum system requirements (Aternity Android Wrapper or Aternity Android Mobile SDK):

Attribute Requirement (Android Wrapper and Aternity Android SDK)

Operating system

Android 4.4 or later.

Java Developer Kit

JDK 1.8 or later.

Programming environment

Google Android Studio or a standalone Android SDK.

Using the SDK Manager, install the latest Android SDK tools (platform tools and build tools) for SDK Platform API level 19 or newer.

Connectivity

Internet access.

App resource usage

When you add Aternity functionality to an Android app:

  • Disk storage barely changes at all.

  • RAM size is an extra 5-10MB.

  • CPU usage rises by 1%.

To run a monitored app, the device must have the following operating systems:

Attribute Requirement

iOS operating system of monitored device

iOS 9 or later.

Android operating system of monitored device

Android 4.4 or later.

In addition, ensure you have already done the following:

Declaration

void setUsername(String name); 

Parameters

Parameter Description

name

Set this to be the username you want to appear in the dashboards, defined as a string.

Example

import com.aternity.sdk.Aternity;
public class CardViewActivity extends Activity {
    public void processLogin() {
        //report username to Aternity
        Aternity.getInstance().setUsername("brandi_calton");
    }
}