Install our SDK

Choose your Operating System:
Android iOS

Install UXRecord client library. Follow our guide to use screen recording and track heatmap events in your existing Android app.

Download the client library

1
Currently SDK supports devices with Android OS version 5.0 and higher.
Add the following to build.gradle:
				
	android {
		compileSdkVersion ..
		buildToolsVersion ..

		defaultConfig {
			...
			minSdkVersion 21
			targetSdkVersion ..
			...

			// Enabling multidex support.
			multiDexEnabled true
		}

		...
	}
	repositories {
		maven { url 'https://s3.amazonaws.com/s3-uxrecord/maven/release' }
	}
	dependencies {
		compile 'io.sdk.android:uxrecord:1.21'
	}
						  
			  
Occassionally when using many libraries or a extremely large library in an Android project you will recieve an error such as "ClassNotFoundException: Didn't find class on path: DexPathList" or "Error converting bytecode to dex". This is likely because you exceeded the dex limit. Android is bulit on the Dalvik Executable specification, which by default has a 64k reference limit. Luckily, you can bypass the limit by enabling Multidex Support. This is a simple one step process by setting multiDexEnabled true.

Add required permissions and components

2
Add following permissions to your app’s AndroidManifest.xml:
				
	<uses-permission android:name="android.permission.INTERNET" />
	<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
	<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
	<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
	<uses-permission android:name="android.permission.RECORD_AUDIO" />
	<uses-permission android:name="android.permission.CAMERA" />
	<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
	<uses-permission android:name="android.permission.WRITE_SETTINGS" />
				
			  
Add the following meta-data with your app key (access token generated from UXRecord web application):
Create your app key here
				
	<meta-data android:name="io.uxrecord.ApiKey" android:value="Your access token generated from UXRecord web application" />
				
			  
Add following components:
				
	<activity android:name="com.uxrecord.activities.UxRecordMainActivity" android:launchMode="singleTask" />
	<service android:name="com.uxrecord.service.UploadService" android:exported="false" />
	<service android:name="com.uxrecord.record.CameraRecorderService" android:exported="false"/>
	<service android:name="com.amazonaws.mobileconnectors.s3.transferutility.TransferService" android:enabled="true" />
				
			  

Initialization

3
Before you can start recording data or obtaining heatmap information, you must initialize the UXRecord client.
You should create an instance of UXRecord inside subclass of Application.
		
	in AndroidManifest.xml

	..
	<application
		android:name="<your package name>.MyApplication"
	..
		
	  
		
	import com.uxrecord.UxRecord;

	...
	public class MyApplication extends Application {

		@Override
		public void onCreate() {
			super.onCreate();
			UxRecord.init(this);
		}

	}
	..
		
	  
For Timeline and Heatmap tracking , you need to record a number of events within your application. These events are periodically uploaded to UXRecord platform, and are reflected on the Dashboard.
For activities you must notify UxRecordManager about activity’s lifecycle.
The following code shows an example:
		
	public class BaseActivity extends AppCompatActivity {

		public boolean dispatchTouchEvent(MotionEvent event) {
			UxRecordManager.get(this).updateDrawingPoints(event); // collect touches from current activity
			return super.dispatchTouchEvent(event);
		}

		@Override
		protected void onResume() {
			super.onResume();
			UxRecordManager.get(this).registerActivity(); //register activity which should be tracked
		}

		@Override
		protected void onStop() {
			super.onStop();
			UxRecordManager.get(this).unregisterActivity(); //unregister activity from tracking
		}
	}
		
	  
To be able to register fragments too, you have to register the UxRecordManager on the host activity of the fragment as we described above, because fragment’s lifecycle is directly affected by the host activity’s lifecycle and then you have to register UxRecordManager on fragment using registerFragment() method.
The following code shows an example:
		
	public class BaseFragment extends Fragment{

		@Override
		public void onResume() {
			super.onResume();
			UxRecordManager.get(getActivity()).registerFragment(); //register fragment which should be tracked
		}

		@Override
		public void onStop() {
			super.onStop();
			UxRecordManager.get(getActivity()).unregisterFragment(); //unregister fragment from tracking
		}

	}
		
	  

Security

4
For security reasons,apps can protect their sensitive screens from third party screen capturing and sharing. This is possible using the FLAG_SECURE option on any given screen.
The following code shows an example:
				
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		getWindow().setFlags(LayoutParams.FLAG_SECURE,LayoutParams.FLAG_SECURE);
		…
		…
	}
				
			  

Usage

5
In order to display the UXRecord settings screen, you can simply shake the device or call the method below:
				
	UxRecordIntentFactory.goToNext(this, UxRecordMainActivity.class);
				
			  

Install UXRecord framework. Follow our guide to use screen recording and track heatmap events in your existing iOS app.

Download the framework

1
Download the framework by pressing the download button and unzip it after.
Download SDK

Add the framework and path to the project

2
  1. Copy the unzipped framework to your project folder.
  2. In your project go to your targets -> General tab and add the framework from your folder project to Embedded Binaries.
  3. In your project go to your targets -> Build Settings tab -> Runpath search paths and add:
				
        @executable_path/Frameworks
				
			  

For iOS 10+ add permission to your application’s .plist

3
  1. Privacy - Camera Usage Description with value : Used to face record.
  2. Privacy - Photo Library Usage Description with value : Save records in library.
  3. Privacy - Microphone Usage Description with value: Used to record feedback.

Initialization

4
Before you can start recording data or obtaining heatmap information, you must initialize the UXRecord client. Your token is generated on UXRecord web.

OBJC:
1. Import header to your AppDelegate:
				
        import <UXRecord/UXRecordSDK.h>
				
			  
2. Add to “didFinishLaunchingWithOptions” method in AppDelegate:
Create your app key here
				
        [UXRecordSDK setupWithToken:@"your UXRecord generated token here"];
				
			  
SWIFT:
1. In your project go to Targets -> Build Settings -> Linking -> Other Linker Flags -> add -ObjC.
2. Create a bridging-header by adding an objective header file and converting automatically (the form should be like this: “ProjectName-Bridging-Header.h”).
3. Import the following in your bridging-header file:
					
        #import <Foundation/Foundation.h>
        #import <UXRecord/UXRecordSDK.h>
					
			  		
4. Import header to your AppDelegate:
					
        import UXRecord
					
			  		
5. Add to “didFinishLaunchingWithOptions” method in AppDelegate:
Create your app key here
					
	UXRecordSDK.setup(withToken:"your UXRecord generated token here")
					
			  		

Usage

5
In order to display the UXRecord settings screen, you can simply shake the device or call the method below:

OBJC:
				
        [UXRecordSDK openUXRecordSettingsScreen];
				
			  
SWIFT:
				
        UXRecordSDK.openUXRecordSettingsScreen()