---
title: Android 
slug: android
docTags: 
createdAt: 2022-04-12T07:13:52.000Z
---

To work with Eyrene Deeplink on Android:

***

:::ExpandableHeading{isOpen="true"}
# 1. Install and configure the SDK



To call the Eyrene app, create an Intent and call `DeepLinkActivity` with `startActivityForResult`.

```java
Intent launchIntent = new Intent();
launchIntent.setAction(DeepLinkConst.IC_CAMERA_LAUNCH_ACTION);
```
:::

***

::::ExpandableHeading{isOpen="true"}
# 2. Sync Master Data

To work with the app offline, sync master data.

:::hint{type="info"}
**Note**

We recommend syncing data once at the beginning of the day, with stable internet


:::

## Request parameters

***

**`DeepLinkConst.IC_CAMERA_LAUNCH_ACTION`** *string*

The intent of [launch ](https://docs.eyrene.com/android#tu-1-install-and-configure-the-sdk)Eyrene on the device.

***

**`DeepLinkConst.Parameters.TOKEN`** *string*

<font color="#ff0000">Required</font>. Calling application ID.

***

**`DeepLinkConst.Parameters.IC_COMMAND`** *string*

Control command.

***

**`DeepLinkConst.Parameters.LIST_CUSTOMER_ID`** *string\[]*

An array of strings with `CUSTOMER_ID` store codes to sync data on these stores.

***

**`DeepLinkConst.Parameters.STRING_CUSTOMER_ID`** *string*

An alternative options list with `CUSTOMER_ID` store codes to sync data for these stores. In this format, a string with `CUSTOMER_ID` codes is passed, which is separated by a comma (",") without spaces.&#x20;

If both methods are specified, then the values ​​from `STRING_CUSTOMER_ID` will be used.

***

## Request example[​](https://help.inspector-cloud.com/docs/api/mobile/sdk_android/sync_master_data#%D0%BF%D1%80%D0%B8%D0%BC%D0%B5%D1%80-%D0%B7%D0%B0%D0%BF%D1%80%D0%BE%D1%81%D0%B0)

```java
Intent launchIntent = new Intent(DeepLinkConst.IC_CAMERA_LAUNCH_ACTION);

launchIntent.putExtra(DeepLinkConst.Parameters.TOKEN, getDemoToken());
launchIntent.putExtra(DeepLinkConst.Parameters.IC_COMMAND, DeepLinkConst.Commands.IC_SYNC);

String[] listCustomerId = {
   "id1",
   "id2",
   "id3",
   "id4",
   "id5"
}; // store list example
launchIntent.putExtra(DeepLinkConst.Parameters.LIST_CUSTOMER_ID, listCustomerId);

startActivityForResult(launchIntent, ICDeepLink.DEFAULT_REQUEST_CODE);
```

## Response example[​](https://help.inspector-cloud.com/docs/api/mobile/sdk_android/sync_master_data#%D0%BF%D1%80%D0%B8%D0%BC%D0%B5%D1%80-%D0%BE%D1%82%D0%B2%D0%B5%D1%82%D0%B0)

```java
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   if (data == null) {
      return;
   }
   Log.d(TAG, "Result code: " + data.getIntExtra(DeepLinkConst.Parameters.RESULT_CODE, 0));
   Log.d(TAG, "Result info: " + data.getStringExtra(DeepLinkConst.Parameters.RESULT_INFO));
   Log.d(TAG, "list_customer_id: " + data.getStringExtra(DeepLinkConst.Parameters.LIST_CUSTOMER_ID));
}
```

## Response parameters[​](https://help.inspector-cloud.com/docs/api/mobile/sdk_android/sync_master_data#%D0%BF%D0%B0%D1%80%D0%B0%D0%BC%D0%B5%D1%82%D1%80%D1%8B-%D0%BE%D1%82%D0%B2%D0%B5%D1%82%D0%B0)

***

**`DeepLinkConst.Parameters.RESULT_CODE`** *integer*

Result code.

- `VISIT_VALID` (int: 1) - successful visit (new or open). Completed with the button to close the visit.
- `VISIT_ERR` (int: 2) - visit error. Detailed information in RESULT\_INFO.
- `SYNC_OK` (int: 3) - Synchronization completed successfully.
- `SYNC_ERR` (int: 4) - Synchronization failed. Detailed information in RESULT\_INFO.

***

**`DeepLinkConst.Parameters.RESULT_INFO`** *string*

Error description or additional information.

***

**`DeepLinkConst.Parameters.LIST_CUSTOMER_ID`** *array*

An array of strings with `CUSTOMER_ID` codes of stores for which sync is performed.

***

After the sync is completed, the control will automatically return to the calling app.


::::

***

:::ExpandableHeading{isOpen="true"}
# 3. Start visit

You can start or open a visit for viewing without prior synchronization. In this case, you will need an Internet connection at the point of sale. Information about the store will be loaded at the beginning of the visit.

## Request parameters[​](https://help.inspector-cloud.com/docs/api/mobile/sdk_android/visits#%D0%BF%D0%B0%D1%80%D0%B0%D0%BC%D0%B5%D1%82%D1%80%D1%8B-%D0%B7%D0%B0%D0%BF%D1%80%D0%BE%D1%81%D0%B0)

***

**`DeepLinkConst.IC_CAMERA_LAUNCH_ACTION`** *string*

The intent of [launch ](https://docs.eyrene.com/android#tu-1-install-and-configure-the-sdk)Eyrene on the device.

***

**`DeepLinkConst.Parameters.IC_COMMAND`** *string*

Control command.

***

**`DeepLinkConst.Parameters.DEBUG`** *boolean*

Enable debug mode. Displays a log with the output of the main errors and calling parameters. Optional.

***

**`DeepLinkConst.Parameters.TOKEN`** *string*

<font color="#ff0000">Required</font>. Calling application ID.

***

**`DeepLinkConst.Parameters.VISIT_ID`** *string*

<font color="#ff0000">Required</font>. Visit ID. If ID:

- found — a visit will be opened;
- not found — a new visit will be created;
- empty or "0" - an error will be returned.

***

**`DeepLinkConst.Parameters.AGENT_ID`** *string*

<font color="#ff0000">Required</font>. Agent ID in UUID format. If the agent ID is not found, a new agent will be created.

***

**`DeepLinkConst.Parameters.CUSTOMER_ID`** *string*

<font color="#ff0000">Required</font>. Store ID.
The store is searched for by CUSTOMER\_ID (store -> customer\_id). If the store:

- not found - an error will be returned, the visit cannot be started;
- found — all store tasks will be added to the visit.

***

**`DeepLinkConst.Parameters.TASK_FILTER`** *string*

Task filter. A regular expression (description) for filtering tasks by name. If specified, the visit will display tasks that match the specified filter. Optional.

***

## Request example[​](https://help.inspector-cloud.com/docs/api/mobile/sdk_android/visits#%D0%BF%D1%80%D0%B8%D0%BC%D0%B5%D1%80-%D0%B7%D0%B0%D0%BF%D1%80%D0%BE%D1%81%D0%B0)

```java
Intent launchIntent = new Intent(DeepLinkConst.IC_CAMERA_LAUNCH_ACTION);

launchIntent.putExtra(DeepLinkConst.Parameters.DEBUG, true);
launchIntent.putExtra(DeepLinkConst.Parameters.TOKEN, getDemoToken());
launchIntent.putExtra(DeepLinkConst.Parameters.VISIT_ID, getDemoVisit());
launchIntent.putExtra(DeepLinkConst.Parameters.AGENT_ID, getDemoAgent());
launchIntent.putExtra(DeepLinkConst.Parameters.CUSTOMER_ID, getDemoCustomerID());
launchIntent.putExtra(DeepLinkConst.Parameters.TASK_FILTER, "regex");

startActivityForResult(launchIntent, ICDeepLink.DEFAULT_REQUEST_CODE);
```

## Response example[​](https://help.inspector-cloud.com/docs/api/mobile/sdk_android/visits#%D0%BF%D1%80%D0%B8%D0%BC%D0%B5%D1%80-%D0%BE%D1%82%D0%B2%D0%B5%D1%82%D0%B0)

The results of the call are returned to the `onActivityResult` function.

```java
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   if (data == null) {
      return;
   }
   Log.d(TAG, "Result code: " + data.getIntExtra(DeepLinkConst.Parameters.RESULT_CODE, 0));
   Log.d(TAG, "Result info: " + data.getStringExtra(DeepLinkConst.Parameters.RESULT_INFO));
   Log.d(TAG, "Visit: " + data.getStringExtra(DeepLinkConst.Parameters.VISIT_ID));
   Log.d(TAG, "Agent: " + data.getStringExtra(DeepLinkConst.Parameters.AGENT_ID));
   Log.d(TAG, "Customer: " + data.getStringExtra(DeepLinkConst.Parameters.CUSTOMER_ID));
   Log.d(TAG, "Images: " + data.getIntExtra(DeepLinkConst.Parameters.TOTAL_IMAGES, 0));
}
```

## Response parameters[​](https://help.inspector-cloud.com/docs/api/mobile/sdk_android/visits#%D0%BF%D0%B0%D1%80%D0%B0%D0%BC%D0%B5%D1%82%D1%80%D1%8B-%D0%BE%D1%82%D0%B2%D0%B5%D1%82%D0%B0)

***

**`DeepLinkConst.Parameters.RESULT_CODE`** *integer*

Result code.

- `VISIT_VALID` (int: 1) - successful visit (new or open). Completed with the button to close the visit.
- `VISIT_ERR` (int: 2) - visit error. Detailed information in RESULT\_INFO.
- `SYNC_OK` (int: 3) - Synchronization completed successfully.
- `SYNC_ERR` (int: 4) - Synchronization failed. Detailed information in RESULT\_INFO.

***

**`DeepLinkConst.Parameters.RESULT_INFO`** *string*

Error description or additional information.

***

**`DeepLinkConst.Parameters.VISIT_ID`** *string*

Visit ID. Value as in input parameter.

***

**`DeepLinkConst.Parameters.AGENT_ID`** *string*

Agent ID. Value as in input parameter.

***

**`DeepLinkConst.Parameters.CUSTOMER_ID`** *string*

Store ID. Value as in input parameter.

***

**`DeepLinkConst.Parameters.TOTAL_IMAGES`** *integer*

The number of images in the visit.

***
:::

***

:::ExpandableHeading{isOpen="true"}
# <font color="#c4c4c4">Optional</font>. Open the last visit

The `OpenLastVisit` command finds the ID of the last visit started in the store and opens it.

## Request parameters[​](https://help.inspector-cloud.com/docs/api/mobile/sdk_android/open_last_visit#%D0%BF%D0%B0%D1%80%D0%B0%D0%BC%D0%B5%D1%82%D1%80%D1%8B-%D0%B7%D0%B0%D0%BF%D1%80%D0%BE%D1%81%D0%B0)

***

**`DeepLinkConst.IC_CAMERA_LAUNCH_ACTION`** *string*

The intent of [launch ](https://docs.eyrene.com/android#tu-1-install-and-configure-the-sdk)Eyrene on the device.

***

**`DeepLinkConst.Parameters.IC_COMMAND`** *string*

Control command.

***

**`DeepLinkConst.Parameters.DEBUG`** *boolean*

Enable debug mode. Displays a log with the output of the main errors and calling parameters. Optional.

***

**`DeepLinkConst.Parameters.TOKEN`** *string*

<font color="#ff0000">Required</font>. Calling application ID.

***

**`DeepLinkConst.Parameters.AGENT_ID`** *string*

<font color="#ff0000">Required</font>. Agent ID in UUID format. If the agent ID is not found, a new agent will be created.

***

**`DeepLinkConst.Parameters.CUSTOMER_ID`** *string*

<font color="#ff0000">Required</font>. Store ID.
The store is searched for by CUSTOMER\_ID (store -> customer\_id). If the store:

- not found - an error will be returned, the visit cannot be started;
- found — all store tasks will be added to the visit.

***

## Request example[​](https://help.inspector-cloud.com/docs/api/mobile/sdk_android/open_last_visit#%D0%BF%D1%80%D0%B8%D0%BC%D0%B5%D1%80-%D0%B7%D0%B0%D0%BF%D1%80%D0%BE%D1%81%D0%B0)

```java
Intent launchIntent = new Intent(DeepLinkConst.IC_CAMERA_LAUNCH_ACTION);

launchIntent.putExtra(DeepLinkConst.Parameters.IC_COMMAND, DeepLinkConst.Commands.IC_OPEN_LAST_VISIT);
launchIntent.putExtra(DeepLinkConst.Parameters.DEBUG, true);
launchIntent.putExtra(DeepLinkConst.Parameters.TOKEN, getDemoToken());
launchIntent.putExtra(DeepLinkConst.Parameters.AGENT_ID, getDemoAgent());
launchIntent.putExtra(DeepLinkConst.Parameters.CUSTOMER_ID, getDemoStoreCustomerID());

startActivityForResult(launchIntent, ICDeepLink.DEFAULT_REQUEST_CODE);
```

## Response example[​](https://help.inspector-cloud.com/docs/api/mobile/sdk_android/open_last_visit#%D0%BF%D1%80%D0%B8%D0%BC%D0%B5%D1%80-%D0%BE%D1%82%D0%B2%D0%B5%D1%82%D0%B0)

The results of the call are returned to the `onActivityResult` function.

```java
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   if (data == null) {
      return;
   }
   Log.d(TAG, "Result code: " + data.getIntExtra(DeepLinkConst.Parameters.RESULT_CODE, 0));
   Log.d(TAG, "Result info: " + data.getStringExtra(DeepLinkConst.Parameters.RESULT_INFO));
   Log.d(TAG, "Visit: " + data.getStringExtra(DeepLinkConst.Parameters.VISIT_ID));
   Log.d(TAG, "Agent: " + data.getStringExtra(DeepLinkConst.Parameters.AGENT_ID));
   Log.d(TAG, "Customer: " + data.getStringExtra(DeepLinkConst.Parameters.CUSTOMER_ID));
   Log.d(TAG, "Images: " + data.getIntExtra(DeepLinkConst.Parameters.TOTAL_IMAGES, 0));
}
```

## Response parameters[​](https://help.inspector-cloud.com/docs/api/mobile/sdk_android/open_last_visit#%D0%BF%D0%B0%D1%80%D0%B0%D0%BC%D0%B5%D1%82%D1%80%D1%8B-%D0%BE%D1%82%D0%B2%D0%B5%D1%82%D0%B0)

***

**`DeepLinkConst.Parameters.RESULT_CODE`** *integer*

Result code.

- `VISIT_VALID` (int: 1) - successful visit (new or open). Completed with the button to close the visit.
- `VISIT_ERR` (int: 2) - visit error. Detailed information in RESULT\_INFO.
- `SYNC_OK` (int: 3) - Synchronization completed successfully.
- `SYNC_ERR` (int: 4) - Synchronization failed. Detailed information in RESULT\_INFO.

***

**`DeepLinkConst.Parameters.RESULT_INFO`** *string*

Error description or additional information.

***

**`DeepLinkConst.Parameters.VISIT_ID`** *string*

Visit ID. Value as in input parameter.

***

**`DeepLinkConst.Parameters.AGENT_ID`** *string*

Agent ID. Value as in input parameter.

***

**`DeepLinkConst.Parameters.CUSTOMER_ID`** *string*

Store ID. Value as in input parameter.

***

**`DeepLinkConst.Parameters.TOTAL_IMAGES`** *integer*

The number of images in the visit.

***
:::

***

# Constants used in the Android Deeplink

The entire list of constants that are used in the Android Eyrene Deeplink API is described here.

## Parameter List[​](https://help.inspector-cloud.com/docs/api/mobile/sdk_android/const#%D1%81%D0%BF%D0%B8%D1%81%D0%BE%D0%BA-%D0%BF%D0%B0%D1%80%D0%B0%D0%BC%D0%B5%D1%82%D1%80%D0%BE%D0%B2)

```java
public class DeepLinkConst {

   public static final String IC_CAMERA_LAUNCH_ACTION = "inspector.cloud.camera.DeepLinkActivity";
   public static final String IC_CAMERA_3_PACKAGE = "com.iccamera3.app";
   public static final String IC_CAMERA_3_ACTIVITY = "com.iccamera3.app.MainActivity";

   public static final class Parameters {
      public static final String TOKEN = "token";
      public static final String AGENT_ID = "agent_id";
      public static final String VISIT_ID = "visit_id";
      public static final String CUSTOMER_ID = "customer_id";
      public static final String LIST_CUSTOMER_ID = "list_customer_id";
      public static final String STRING_CUSTOMER_ID = "string_customer_id";
      public static final String TASK_FILTER = "task_filter";
      public static final String READONLY = "readonly";
      public static final String TOTAL_IMAGES = "total_images";
      public static final String DEBUG = "debug";
      public static final String VERSION_API = "version_api";
      public static final String VERSION_APP = "version_app";
      public static final String IS_NEW_VISIT = "is_new_visit";
      public static final String RESULT_CODE = "res_code";
      public static final String RESULT_INFO = "res_info";
      public static final String IC_COMMAND = "ic_command";

   }

   public static final class ResultCode {
      public static final int VISIT_VALID = 1;
      public static final int VISIT_ERR = 2;

      public static final int SYNC_OK = 3;
      public static final int SYNC_ERR = 4;
   }

   public static final class Commands {
      public static final String IC_SYNC = "sync";
      public static final String IC_OPEN_LAST_VISIT = "open_last_visit";
   }
}
```

## Description[​](https://help.inspector-cloud.com/docs/api/mobile/sdk_android/const#%D0%BE%D0%BF%D0%B8%D1%81%D0%B0%D0%BD%D0%B8%D0%B5-%D0%BF%D0%B0%D1%80%D0%B0%D0%BC%D0%B5%D1%82%D1%80%D0%BE%D0%B2)

### DeepLinkConst[​](https://help.inspector-cloud.com/docs/api/mobile/sdk_android/const#deeplinkconst)

***

**`DeepLinkConst.IC_CAMERA_LAUNCH_ACTION`** *string*

The intent for [launching](https://docs.eyrene.com/android#tu-1-install-and-configure-the-sdk) Eyrene on the device.

***

**`DeepLinkConst.IC_CAMERA_3_PACKAGE`**, **`DeepLinkConst.IC_CAMERA_3_ACTIVITY`** *string*

Components to run the Eyrene application.

***

### Parameters[​](https://help.inspector-cloud.com/docs/api/mobile/sdk_android/const#parameters)

***

**`DeepLinkConst.Parameters.TOKEN`** *string*

The [token](https://docs.eyrene.com/deeplink-authorization#mi-get-a-token) of the calling application.

***

 **`DeepLinkConst.Parameters.AGENT_ID`** *string*

Agent ID in UUID format.

***

**`DeepLinkConst.Parameters.VISIT_ID`** *string*

**Visit ID

***

**`DeepLinkConst.Parameters.CUSTOMER_ID`** *string*

Store ID. The store is searched for by `CUSTOMER_ID` (store -> customer\_id)

***

**`DeepLinkConst.Parameters.LIST_CUSTOMER_ID`** *string\[]*

An array of strings with `CUSTOMER_ID` codes of stores for which sync is performed.

***

**`DeepLinkConst.Parameters.STRING_CUSTOMER_ID`** *array*

An alternative list option with `CUSTOMER_ID` store codes to synchronize data for these stores.
In this format, a string with `CUSTOMER_ID` codes is passed, which is separated by a comma (",") without spaces. If both methods are specified in the command, then the values ​​from `STRING_CUSTOMER_ID` will be used.

***

**`DeepLinkConst.Parameters.TASK_FILTER`** *string*

Task filter. A regular expression (description) for filtering tasks by name. If specified, the visit will display tasks that match the specified filter.

***

**`DeepLinkConst.Parameters.READONLY`** *boolean*

Задает режим открытия визита только для чтения. В этом режиме задачи доступны только для просмотра.

***

**`DeepLinkConst.Parameters.TOTAL_IMAGES`** *integer*

The number of images in the visit.

***

**`DeepLinkConst.Parameters.DEBUG`** *boolean*

Enable debug mode. Displays a log with the output of the main errors and calling parameters.

***

**`DeepLinkConst.Parameters.VERSION_API`** *integer*

The version of the built-in API in the app.

***

**`DeepLinkConst.Parameters.VERSION_APP`** *integer*

Application version code.

***

**`DeepLinkConst.Parameters.IS_NEW_VISIT`** *boolean*

A flag indicating a newly created visit.

***

### ResultCode[​](https://help.inspector-cloud.com/docs/api/mobile/sdk_android/const#resultcode)

***

**`DeepLinkConst.Parameters.RESULT_CODE`** *integer*

Result code.

- `VISIT_VALID` (int: 1) - successful visit (new or open). Completed with the button to close the visit.
- `VISIT_ERR` (int: 2) - visit error. Detailed information in RESULT\_INFO.
- `SYNC_OK` (int: 3) - Synchronization completed successfully.
- `SYNC_ERR` (int: 4) - Synchronization failed. Detailed information in RESULT\_INFO.

***

**`DeepLinkConst.Parameters.RESULT_INFO`** *string*

Error description or additional information.

***

### Commands[​](https://help.inspector-cloud.com/docs/api/mobile/sdk_android/const#commands)

***

**`DeepLinkConst.Parameters.IC_COMMAND`** *string*

Control command. Supported commands:

- `IC_SYNC` - perform [sync](https://docs.eyrene.com/android#oq-2-sync-master-data);
- `IC_OPEN_LAST_VISIT` - [open the last visit](https://docs.eyrene.com/android#xn-optional-open-last-visit) to the specified store.

# Possible errors

If while Eyrene is running:

- if theapplication was closed by the system or by the user using the "Running Tasks / Delete Eyrene" button, `VISIT_ERR` will be returned as a result.
- a failure occurred - depending on the type of failure, either `VISIT_ERR` or `Intent data` returns `null`.

