目录

StatusCode

Class Info

public final class StatusCode extends Object

Status code for Nearby Service.

Public Constructor Summary

Constructor

public StatusCode()

Creates an instance of StatusCode.

Public Field Summary

Qualifier and Type

Field and Description

static final int

STATUS_SUCCESS

Operation successful.

static final int

STATUS_FAILURE

Operation failed.

static final int

STATUS_API_DISORDER

API calls are out of order.

static final int

STATUS_NO_NETWORK

No network connection (Wi-Fi/Ethernet).

static final int

STATUS_NOT_CONNECTED

The remote endpoint is not connected, and data cannot be sent to it.

static final int

STATUS_TRANSFER_IO_ERROR

Failed to read or write files or data streams.

static final int

STATUS_ALREADY_BROADCASTING

The app is broadcasting. Stop the broadcasting before broadcasting again.

static final int

STATUS_ALREADY_CONNECTED

The app is already connected to the same remote endpoint.

static final int

STATUS_ALREADY_SCANNING

The app is scanning for nearby devices. Stop the scanning before scanning again.

static final int

STATUS_POLICY_CONFLICT

A policy is used by the ongoing scanning and connection. Stop the scanning and connection before enabling a new policy.

static final int

STATUS_BLUETOOTH_OPERATION_FAILED

Connection failed due to a Bluetooth error.

static final int

STATUS_CONNECT_REJECTED

The remote endpoint rejected the connection.

static final int

STATUS_CONNECT_IO_ERROR

Failed to communicate with a connected remote endpoint.

static final int

STATUS_ENDPOINT_UNKNOWN

Attempting to connect to an unknown remote endpoint. The endpoint has not been discovered or connected to other devices yet.

static final int

STATUS_API_OCCUPIED

The Nearby Service API is being used by another app and is unavailable now.

static final int

STATUS_MISSING_PERMISSION_ACCESS_COARSE_LOCATION

The ACCESS_COARSE_LOCATION permission is required.

static final int

STATUS_MISSING_PERMISSION_ACCESS_WIFI_STATE

The ACCESS_WIFI_STATE permission is required.

static final int

STATUS_MISSING_PERMISSION_BLUETOOTH

The BLUETOOTH permission is required.

static final int

STATUS_MISSING_PERMISSION_BLUETOOTH_ADMIN

The BLUETOOTH_ADMIN permission is required.

static final int

STATUS_MISSING_PERMISSION_CHANGE_WIFI_STATE

The CHANGE_WIFI_STATE permission is required.

static final int

STATUS_MISSING_SETTING_LOCATION_ON

The location permission must be enabled.

static final int

STATUS_AIRPLANE_MODE_MUST_BE_OFF

The device is in airplane mode and cannot use the function.

static final int

STATUS_MESSAGE_APP_UNREGISTERED

The app does not have the permission to use the Nearby Message API.

static final int

STATUS_MESSAGE_APP_QUOTA_LIMITED

The app has used up its quota for calling the Nearby Message API.

static final int

STATUS_MESSAGE_BLE_BROADCASTING_UNSUPPORTED

The Nearby Message API is called to perform an operation that requires BLE broadcasting, but the current device does not support this function.

static final int

STATUS_MESSAGE_BLE_SCANNING_UNSUPPORTED

The Nearby Message API is called to perform an operation that requires BLE scanning, but the current device does not support this function.

static final int

STATUS_MESSAGE_BLUETOOTH_OFF

The Bluetooth function needs to be enabled for calling the Nearby Message API.

static final int

STATUS_MESSAGE_WRONG_CONTEXT

The type of parameters passed to the getMessageEngine method is incorrect. Some APIs can be called only on the foreground.

static final int

STATUS_MESSAGE_NOT_ALLOW

The cloud rejects the Nearby Message request because the Nearby Message API is disabled.

static final int

STATUS_MESSAGE_MISSING_PERMISSIONS

The request for calling the Nearby Message API is rejected due to insufficient permissions.

static final int

STATUS_MESSAGE_AUTH_FAILED

The Nearby Message API is not authorized. Check whether the credential is correct.

static final int

STATUS_MESSAGE_PENDING_INTENTS_LIMITED

The number of message subscriptions initiated by the app has reached the upper limit allowed by PendingIntent. Before initiating a new subscription, delete existing subscriptions.

static final int

STATUS_INTERNAL_ERROR

Internal error. For details, please refer to the error description.

static final int

STATUS_FINDING_MODE_ERROR

The nearby device discovery mode is incorrectly set.

static final int

STATUS_MESSAGE_TASK_ALREADY_IN_PROCESSING

The message engine task is being executed.

static final int

STATUS_MISSING_PERMISSION_FILE_READ_WRITE

The file read and write permissions are not assigned to Nearby Connection.

static final int

STATUS_MISSING_PERMISSION_INTERNET

The network permission is not assigned to Nearby Message or Contact Shield.

static final int

STATUS_WIFI_SHARE_USER_AUTH_FAIL

Failed to verify Wi-Fi sharing in a popup.

static final int

STATUS_WIFI_SHARE_WIFI_CLOSED

The sharing endpoint disconnects from the Wi-Fi network during Wi-Fi sharing.

static final int

STATUS_WIFI_CONNECT_FAIL

Wi-Fi connection failed or timed out.

static final int

STATUS_WIFI_NOT_SUPPORT_SHARE

This type of Wi-Fi network cannot be shared.

static final int

STATUS_WIFI_MUST_BE_ENABLED

Failed to call the Nearby Connection API when the Wi-Fi function is disabled.

static final int

STATUS_ANDROID_HMS_RESTRICTED

An error occurred during Nearby so loading.

Public Method Summary

Qualifier and Type

Method Name and Description

String

getStatusCode(int statusCode)

Returns a character string based on a specified status code.

Public Constructors

[h2]StatusCode

Constructor

public StatusCode()

Creates an instance of StatusCode.

Public Fields

[h2]STATUS_SUCCESS

Fields

public static final int STATUS_SUCCESS

Operation successful.

For details, please refer to Constant-values.

[h2]STATUS_FAILURE

Fields

public static final int STATUS_FAILURE

Operation failed.

For details, please refer to Constant-values.

[h2]STATUS_API_DISORDER

Fields

public static final int STATUS_API_DISORDER

API calls are out of order.

For details, please refer to Constant-values.

[h2]STATUS_NO_NETWORK

Fields

public static final int STATUS_NO_NETWORK

No network connection (Wi-Fi/Ethernet).

For details, please refer to Constant-values.

[h2]STATUS_NOT_CONNECTED

Fields

public static final int STATUS_NOT_CONNECTED

The remote endpoint is not connected, and data cannot be sent to it.

For details, please refer to Constant-values.

[h2]STATUS_TRANSFER_IO_ERROR

Fields

public static final int STATUS_TRANSFER_IO_ERROR

Failed to read or write files or data streams.

For details, please refer to Constant-values.

[h2]STATUS_ALREADY_BROADCASTING

Fields

public static final int STATUS_ALREADY_BROADCASTING

The app is broadcasting. Stop the broadcasting before broadcasting again.

For details, please refer to Constant-values.

[h2]STATUS_ALREADY_CONNECTED

Fields

public static final int STATUS_ALREADY_CONNECTED

The app is already connected to the same remote endpoint.

For details, please refer to Constant-values.

[h2]STATUS_ALREADY_SCANNING

Fields

public static final int STATUS_ALREADY_SCANNING

The app is scanning for nearby devices. Stop the scanning before scanning again.

For details, please refer to Constant-values.

[h2]STATUS_POLICY_CONFLICT

Fields

public static final int STATUS_POLICY_CONFLICT

A policy is used by the ongoing scanning and connection. Stop the scanning and connection before enabling a new policy.

For details, please refer to Constant-values.

[h2]STATUS_BLUETOOTH_OPERATION_FAILED

Fields

public static final int STATUS_BLUETOOTH_OPERATION_FAILED

Connection failed due to a Bluetooth error.

For details, please refer to Constant-values.

[h2]STATUS_CONNECT_REJECTED

Fields

public static final int STATUS_CONNECT_REJECTED

The remote endpoint rejected the connection.

For details, please refer to Constant-values.

[h2]STATUS_CONNECT_IO_ERROR

Fields

public static final int STATUS_CONNECT_IO_ERROR

Failed to communicate with a connected remote endpoint.

If this error occurs frequently, disconnect from the remote endpoint and reconnect to it.

For details, please refer to Constant-values.

[h2]STATUS_ENDPOINT_UNKNOWN

Fields

public static final int STATUS_ENDPOINT_UNKNOWN

Attempting to connect to an unknown remote endpoint.

The endpoint has not been discovered or connected to other devices yet.

For details, please refer to Constant-values.

[h2]STATUS_API_OCCUPIED

Fields

public static final int STATUS_API_OCCUPIED

The Nearby Service API is being used by another app and is unavailable now.

For details, please refer to Constant-values.

[h2]STATUS_MISSING_PERMISSION_ACCESS_COARSE_LOCATION

Fields

public static final int STATUS_MISSING_PERMISSION_ACCESS_COARSE_LOCATION

The ACCESS_COARSE_LOCATION permission is required.

For details, please refer to Constant-values.

[h2]STATUS_MISSING_PERMISSION_ACCESS_WIFI_STATE

Fields

public static final int STATUS_MISSING_PERMISSION_ACCESS_WIFI_STATE

The ACCESS_WIFI_STATE permission is required.

For details, please refer to Constant-values.

[h2]STATUS_MISSING_PERMISSION_BLUETOOTH

Fields

public static final int STATUS_MISSING_PERMISSION_BLUETOOTH

The BLUETOOTH permission is required.

For details, please refer to Constant-values.

[h2]STATUS_MISSING_PERMISSION_BLUETOOTH_ADMIN

Fields

public static final int STATUS_MISSING_PERMISSION_BLUETOOTH_ADMIN

The BLUETOOTH_ADMIN permission is required.

For details, please refer to Constant-values.

[h2]STATUS_MISSING_PERMISSION_CHANGE_WIFI_STATE

Fields

public static final int STATUS_MISSING_PERMISSION_CHANGE_WIFI_STATE

The CHANGE_WIFI_STATE permission is required.

For details, please refer to Constant-values.

[h2]STATUS_MISSING_SETTING_LOCATION_ON

Fields

public static final int STATUS_MISSING_SETTING_LOCATION_ON

The location permission must be enabled.

For details, please refer to Constant-values.

[h2]STATUS_AIRPLANE_MODE_MUST_BE_OFF

Fields

public static final int STATUS_AIRPLANE_MODE_MUST_BE_OFF

The device is in airplane mode and cannot use the function.

For details, please refer to Constant-values.

[h2]STATUS_MESSAGE_APP_UNREGISTERED

Fields

public static final int STATUS_MESSAGE_APP_UNREGISTERED

The app does not have the permission to use the Nearby Message API.

For details, please refer to Constant-values.

[h2]STATUS_MESSAGE_APP_QUOTA_LIMITED

Fields

public static final int STATUS_MESSAGE_APP_QUOTA_LIMITED

The app has used up its quota for calling the Nearby Message API.

For details, please refer to Constant-values.

[h2]STATUS_MESSAGE_BLE_BROADCASTING_UNSUPPORTED

Fields

public static final int STATUS_MESSAGE_BLE_BROADCASTING_UNSUPPORTED

The Nearby Message API is called to perform an operation that requires BLE broadcasting, but the current device does not support this function.

For details, please refer to Constant-values.

[h2]STATUS_MESSAGE_BLE_SCANNING_UNSUPPORTED

Fields

public static final int STATUS_MESSAGE_BLE_SCANNING_UNSUPPORTED

The Nearby Message API is called to perform an operation that requires BLE scanning, but the current device does not support this function.

For details, please refer to Constant-values.

[h2]STATUS_MESSAGE_BLUETOOTH_OFF

Fields

public static final int STATUS_MESSAGE_BLUETOOTH_OFF

The Bluetooth function needs to be enabled for calling the Nearby Message API.

For details, please refer to Constant-values.

[h2]STATUS_MESSAGE_WRONG_CONTEXT

Fields

public static final int STATUS_MESSAGE_WRONG_CONTEXT

The type of parameters passed to the getMessageEngine method is incorrect. Some APIs can be called only on the foreground.

For details, please refer to Constant-values.

[h2]STATUS_MESSAGE_NOT_ALLOW

Fields

public static final int STATUS_MESSAGE_NOT_ALLOW

The cloud rejects the Nearby Message request because the Nearby Message API is disabled.

For details, please refer to Constant-values.

[h2]STATUS_MESSAGE_MISSING_PERMISSIONS

Fields

public static final int STATUS_MESSAGE_MISSING_PERMISSIONS

The request for calling the Nearby Message API is rejected due to insufficient permissions.

For details, please refer to Constant-values.

[h2]STATUS_MESSAGE_AUTH_FAILED

Fields

public static final int STATUS_MESSAGE_AUTH_FAILED

The Nearby Message API is not authorized. Check whether the credential is correct.

For details, please refer to Constant-values.

[h2]STATUS_MESSAGE_PENDING_INTENTS_LIMITED

Fields

public static final int STATUS_MESSAGE_PENDING_INTENTS_LIMITED

The number of message subscriptions initiated by the app has reached the upper limit allowed by PendingIntent. Before initiating a new subscription, delete existing subscriptions.

For details, please refer to Constant-values.

[h2]STATUS_INTERNAL_ERROR

Fields

public static final int STATUS_INTERNAL_ERROR

Internal error. For details, please refer to the error description.

For details, please refer to Constant-values.

[h2]STATUS_FINDING_MODE_ERROR

Fields

public static final int STATUS_FINDING_MODE_ERROR

The nearby device discovery mode is incorrectly set.

For details, please refer to Constant-values.

[h2]STATUS_MESSAGE_TASK_ALREADY_IN_PROCESSING

Fields

public static final int STATUS_MESSAGE_TASK_ALREADY_IN_PROCESSING

The message engine task is being executed.

For details, please refer to Constant-values.

[h2]STATUS_MISSING_PERMISSION_FILE_READ_WRITE

Fields

public static final int STATUS_MISSING_PERMISSION_FILE_READ_WRITE

The file read and write permissions are not assigned to Nearby Connection.

For details, please refer to Constant-values.

[h2]STATUS_MISSING_PERMISSION_INTERNET

Fields

public static final int STATUS_MISSING_PERMISSION_INTERNET

The network permission is not assigned to Nearby Message or Contact Shield.

For details, please refer to Constant-values.

[h2]STATUS_WIFI_SHARE_USER_AUTH_FAIL

Fields

public static final int STATUS_WIFI_SHARE_USER_AUTH_FAIL

Failed to verify Wi-Fi sharing in a popup.

For details, please refer to Constant-values.

[h2]STATUS_WIFI_SHARE_WIFI_CLOSED

Fields

public static final int STATUS_WIFI_SHARE_WIFI_CLOSED

The sharing endpoint disconnects from the Wi-Fi network during Wi-Fi sharing.

For details, please refer to Constant-values.

[h2]STATUS_WIFI_CONNECT_FAIL

Fields

public static final int STATUS_WIFI_CONNECT_FAIL

Wi-Fi connection failed or timed out.

For details, please refer to Constant-values.

[h2]STATUS_WIFI_NOT_SUPPORT_SHARE

Fields

public static final int STATUS_WIFI_NOT_SUPPORT_SHARE

This type of Wi-Fi network cannot be shared.

For details, please refer to Constant-values.

[h2]STATUS_WIFI_MUST_BE_ENABLED

Fields

public static final int STATUS_WIFI_MUST_BE_ENABLED

Failed to call the Nearby Connection API when the Wi-Fi function is disabled.

For details, please refer to Constant-values.

[h2]STATUS_ANDROID_HMS_RESTRICTED

Fields

public static final int STATUS_ANDROID_HMS_RESTRICTED

An error occurred during Nearby so loading.

For details, please refer to Constant-values.

Public Methods

[h2]getStatusCode

Method

public static String getStatusCode(int statusCode)

Returns a character string based on a specified status code.

Parameters

Name

Description

statusCode

Status code.

Returns

Type

Description

String

Status code description.