Class BitwardsService

java.lang.Object
fi.bitwards.service.BitwardsService

public final class BitwardsService extends Object

BitwardsService — SDK Usage Guide

Contents

Introduction

BitwardsService is the main entry point of Bitwards SDK. All SDK operations are performed through this class. The main areas of functionality are:

  • initializing the SDK and logging the end user in and out,
  • synchronizing the local credential database with the backend server,
  • scanning for nearby Bluetooth Low Energy (BLE) based resources,
  • accessing resources via BLE or NFC, and
  • retrieving the resource list and user profile data.

The following sections describe each of these areas with code examples.

Most SDK operations are asynchronous: an operation is triggered by a method call and its result is delivered through a callback. All SDK methods should be called from the main (UI) thread; all callbacks are also executed on the main thread.

NOTE: All documentation assumes that the developer is familiar with Android development. For project setup instructions (Gradle dependency, manifest configuration, permissions), see the package overview.

User Experience (UX) Considerations

Bitwards SDK supports several access interaction patterns for BLE-based resources. The right pattern depends on the use case and the desired end-user experience. All patterns rely on the Bluetooth signal strength (RSSI) reported by BitwardsResource.getRSSI(). Note that RSSI is an inherently noisy measurement: it varies with phone model, resource hardware, resource configuration, and the surrounding physical environment (walls, furniture, other devices). This variability must be taken into account when designing RSSI-based UX.

Manual Opening

In this pattern the application runs the background scan continuously and presents the end user with a list of resources. The list may show all known resources, or it may be filtered to show only the resources currently in Bluetooth range. Each list item should display the resource name (so the end user can identify the correct one) and a visual indicator of signal strength (so nearby resources are easy to spot). Because BitwardsService.BackgroundScanCallback.onResourceFound(BitwardsResource) is called approximately every 500 ms per nearby resource, the signal-strength indicator can be updated in real time, giving the end user a live sense of proximity.

When the end user taps a resource, the application calls accessResource(BitwardsResource, BLEResourceCallback) for that resource. The UI should immediately show a progress state (e.g., "Accessing…") while the BLE communication is in progress. Once the callback fires, the UI should update to reflect the outcome:

  • Access granted — show a clear success indicator (e.g., a green checkmark or "Access granted" message).
  • Access denied — inform the end user that access was not permitted, and include a reason where available (e.g., "Outside of allowed hours").
  • Error — inform the end user that the attempt failed and allow them to retry. Transient BLE errors are common; a single retry is usually sufficient.

Automatic Opening

Automatic opening removes the need for the end user to tap a resource explicitly. The application runs the background scan and monitors the RSSI of each nearby resource. When the RSSI of a resource crosses a configured threshold — meaning the phone has been brought physically close to the resource — the application initiates the access attempt automatically. This closely resembles the UX of NFC-based access, where the end user simply holds the phone near the reader to trigger opening.

The main challenge of this pattern is choosing an appropriate RSSI threshold. Because RSSI is affected by phone hardware, resource hardware, resource firmware configuration, and environmental factors (walls, metal surfaces, interference), a single universal threshold is unlikely to work well across all deployments. In practice, the threshold often needs to be tuned at least per resource type, and in some cases per phone model. The following considerations help in setting a workable threshold:

  • Start with a conservative (strong signal) threshold, e.g., −55 dBm, and adjust based on real-world testing in the target environment.
  • Apply hysteresis: require the signal to remain above the threshold for a short time (e.g., 1–2 seconds) before triggering, to avoid false positives caused by momentary spikes.
  • Ensure only one access attempt is triggered per approach: once an attempt has been started for a resource, ignore further threshold crossings for that resource until the attempt completes and the signal drops below the threshold again.
  • Show status and result feedback the same way as in the Manual Opening pattern.

Discover and Access Resource

discoverAndAccessResource(BLEResourceCallback) provides a self-contained scan-then-access flow without requiring a continuously running background scan. The SDK performs an internal BLE scan for a few seconds, collects all nearby known resources, and returns them sorted by signal strength (strongest first) via the onSelectResource() callback. The application then picks the resource to open and signals its selection back to the SDK via BitwardsService.SelectResourceCallback.

The most natural UX for this pattern is a single prominent button such as "Open nearest door". When the end user taps the button:

  1. The application shows a scanning indicator (e.g., "Looking for nearby resources…").
  2. Once resources are discovered, the application either automatically selects the closest one (first in the list) or presents a brief selection dialog if multiple resources are found.
  3. The SDK attempts to open the selected resource and reports the outcome via the same callback, which the application reflects in the UI as described in Manual Opening.
This pattern requires no background scan setup and is well suited to simpler use cases where the end user expects a single-tap experience without a persistent resource list.

Error and Reason Code Reference

Most BitwardsService operations report failures by delivering an integer error code to the relevant callback's onError(int) method, or by throwing a BitwardsException whose error code can be retrieved via BitwardsException.getErrorCode(). Access denials from the physical reader are reported as integer reason codes via BitwardsService.NFCResourceCallback.onAccessDenied(BitwardsResource, int).

There are many error and reason codes, each covering a specific failure condition. They are fully documented — with descriptions, commonality ratings, and emission sources — in the separate Error and Reason Code Reference.

Initialize SDK

Bitwards SDK is initialized by calling getInstance(Context, String), which returns a singleton BitwardsService instance — the same instance is returned on every call.

IMPORTANT: The required permissions must be granted by the end user before calling getInstance(Context, String). If the permissions have not been granted, the call will throw a BitwardsException and the SDK cannot be used.

The required permissions depend on the Android version:

  • Android 11 or older (SDK 30 or lower): ACCESS_FINE_LOCATION must be granted. See Request location permissions for details.
  • Android 12 or newer (SDK 31 or higher): BLUETOOTH_SCAN and BLUETOOTH_CONNECT must be granted. If the application does not use ACCESS_FINE_LOCATION, the BLUETOOTH_SCAN declaration in the manifest must include android:usesPermissionFlags="neverForLocation", otherwise Bluetooth scanning will not work. See Bluetooth permissions for details.

It is recommended to check for the required permissions each time the application starts, as Android may revoke permissions that have not been used for an extended period.

Note: Bitwards SDK no longer requires device lock to be enabled.

 String license = "contains license that is obtained from Bitwards (currently not used)";

 // Get the BitwardsService singleton instance:
 BitwardsService bws = BitwardsService.getInstance(context.getApplicationContext(), license);

Login end user

A BitwardsService instance is not usable until an end user has logged in. Login can be performed either with a username and password, or with an OAuth2 authentication token, if the server configuration allows it.

 // Create credential with username and password (if username/password is used)
 BitwardsCredential passwordCredential = new BitwardsCredential.Builder(BitwardsCredential.TYPE_USERNAME_PASSWORD)
     .setUsername(USERNAME)
     .setPassword(PASSWORD)
     .build();

 // Create credential with OAuth2 (if OAuth2 token is used)
 BitwardsCredential oauth2token = new BitwardsCredential.Builder(BitwardsCredential.TYPE_OAUTH2_AUTH_TOKEN)
     .setAuthenticationToken(AUTH_TOKEN)
     .setAuthenticationDomain(AUTH_DOMAIN)
     .build();

 // Create credential with OAuth2 (if OAuth2 authorization_code is used)
 BitwardsCredential oauth2authorizationCode = new BitwardsCredential.Builder(BitwardsCredential.TYPE_OAUTH2_AUTH_TOKEN)
     .setAuthenticationToken(AUTHORIZATION_CODE)
     .setAuthenticationDomain(AUTH_DOMAIN)
     .setGrantType("authorization_code")
     .setRedirectUrl(REDIRECT_URL)
     .build();

 // Login with credential (this time OAuth2)
 bws.login(oauth2token, new BitwardsService.ResultCallback() {
     @Override
     public void onSuccess() {
         // Login was successful
     }

     @Override
     public void onError(int errorCode) {
         // Login failed
     }
 });

 // Register a callback to be notified when the session expires (user is logged out):
 bws.setAuthenticationTokenExpiredCallback((bitwardsService) -> {
     // Handle session expiry (e.g., notify the user that they have
     // been logged out and navigate to the login screen).
 });

Setup callback for NFC based resources

Bitwards SDK can access resources via NFC. NFC-based opening happens automatically, but if the application wants to receive notifications for these events, it must register a BitwardsService.NFCResourceCallback.

If resource opening with NFC based resource access is required to be supported when application is not running or when it is in the background, the FOREGROUND_SERVICE_CONNECTED_DEVICE permission needs to be declared in Android 14 and later. See Foreground service types and espacially Connected Device section in particular for details.

NOTE: If NFC based resources needs to be supported, a nfcservice.xml file needs to be placed to the res/xml directory in the module in your application project. Please request the nfcservice.xml file from Bitwards.

 // Setup callback for NFC based resources
 bws.setNFCResourceCallback(new BitwardsService.NFCResourceCallback() {
     @Override
     public void onAccessGranted(BitwardsResource resource) {
         // Access to a NFC based resource was granted
     }

     @Override
     public void onAccessDenied(BitwardsResource resource, int reasonCode) {
         // Access to a NFC based resource was denied
     }

     @Override
     public void onError(BitwardsResource resource, int errorCode) {
         // An error occurred when accessing a NFC based resource
     }
 });

Synchronize with backend server

Bitwards SDK synchronizes with the backend server automatically once an hour. If the application needs to ensure that the data (e.g., the known resource list) is immediately up to date, call synchronize(ResultCallback) manually.

 // Synchronize Bitwards SDK's database with the backend server
 bws.synchronize(new BitwardsService.ResultCallback() {
     @Override
     public void onSuccess() {
         // Synchronization with the backend server was successful
     }

     @Override
     public void onError(int errorCode) {
         // Synchronization failed
     }
 });

Get known resource list

The known resource list is the list of resources that the end user either has access currently, or will have access in the future. Each BitwardsResource in the list can be passed to accessResource(BitwardsResource, BLEResourceCallback) to access the resource (e.g., open it).

 // Obtain the known resource list
 List<BitwardsResource> list = bws.getBitwardsResourceList();

Register/unregister for discovering resources nearby

The background scan discovers nearby Bluetooth-based resources (BLE resources). When a BitwardsService.BackgroundScanCallback instance is registered with the Bitwards SDK, its callback methods notify the application that a resource has come into range or has been lost (i.e., is no longer nearby). BitwardsService.BackgroundScanCallback.onResourceFound(BitwardsResource) is called approximately every 500 ms per resource while it is in Bluetooth range.

The application can obtain the current signal strength using BitwardsResource.getRSSI(), which returns an RSSI (received signal strength indicator) estimate based on Bluetooth advertisement messages received over the past 10 seconds. If no advertisement messages have been received, the RSSI value gradually decreases to −99, after which BitwardsService.BackgroundScanCallback.onResourceLost(BitwardsResource) is called. This smoothing logic prevents the value from fluctuating too much and accounts for the fact that battery-powered resources may not transmit advertisement messages as frequently as mains-powered ones. The smoothed RSSI value can therefore be used directly in the application UI to display signal strength.

 // Instantiate BackgroundScanCallback instance
 BitwardsService.BackgroundScanCallback callback = new BitwardsService.BackgroundScanCallback() {
     @Override
     public void onResourceFound(BitwardsResource resource) {
         // called each time a resource is detected; approximately every 500 ms per nearby resource

         // Obtain the Bluetooth signal strength (RSSI):
         int rssi = resource.getRSSI();
         // rssi value is typically between −30 and −99, where
         // −30 means signal is strong (resource is very close), and
         // −70 means signal is weak (resource is farther away).
     }

     @Override
     public void onResourceLost(BitwardsResource resource) {
         // a previously found resource is no longer nearby
     }

     @Override
     public void onError(int errorCode) {
         // an error occurred during background scan; scan is stopped
     }
 };

 // Register callback with BitwardsService for background scan callbacks
 bws.registerBackgroundScanCallback(callback);

 // Unregister callback when you are done with background scan callbacks
 bws.unregisterBackgroundScanCallback(callback);

Access a resource

To access a resource (e.g., opening it) call accessResource(BitwardsResource, BLEResourceCallback). Best practice is that the application first discovers nearby resources with the background scan callback, and then populates a list of available resources in the application UI. The end user then taps one of the available resources, which triggers calling of accessResource(BitwardsResource, BLEResourceCallback) with the indicated BitwardsResource instance.

 // Accessing (e.g., opening) a particular resource
 bws.accessResource(resource, new BitwardsService.BLEResourceCallback() {
     @Override
     public void onSelectResource(List<BitwardsResource> resources, BitwardsService.SelectResourceCallback callback) {
         // In this case (i.e., resource was already indicated in the method call),
         // this is not gonna be called because we are accessing directly the particular resource.
     }

     @Override
     public void onResourceNotFound(BitwardsResource resource) {
         // The BLE based resource was not found, i.e., it is not nearby.
     }

     @Override
     public void onAccessGranted(BitwardsResource resource) {
         // Access was granted to the BLE based resource.
     }

     @Override
     public void onAccessDenied(BitwardsResource resource, int reasonCode) {
         // Access was denied to the BLE based resource.
     }

     @Override
     public void onError(BitwardsResource resource, int errorCode) {
         // An error occurred while accessing the BLE based resource.
         // This happens sometimes.  Application can indicate the error
         // in the UI, and the end user can try to access the resource again.
     }
 });

Discover and access a selected resource

discoverAndAccessResource(BLEResourceCallback) is one method call that does both the discovery (scans of known resources) as well as access a resource that was selected. Essentially, this is the same as using the background scan callback combined with accessing a discovered resource. First a two-and-a-half second Bluetooth scan is performed. Second, a list of discovered known resources are returned via the onSelectResource() callback. Third, a resource can be selected to be accessed and it is indicated with the BitwardsService.SelectResourceCallback interface. Finally, the selected resource is accessed.

 // First scan for any nearby known resources and then select the resource to be accessed:
 bws.discoverAndAccessResource(new BitwardsService.BLEResourceCallback() {
     @Override
     public void onSelectResource(List<BitwardsResource> resources, BitwardsService.SelectResourceCallback callback) {
         // Select among the discovered BLE based resources which one to open,
         // resource with strongest bluetooth signal is first in the list

         // As an example, we are going to select the resource with
         // strongest bluetooth signal (i.e., first resource on the list)
         callback.selectedResource(resources.get(0));
     }

     @Override
     public void onResourceNotFound(BitwardsResource resource) {
         // No resources were found during the scan phase.
     }

     @Override
     public void onAccessGranted(BitwardsResource resource) {
         // Access was granted for the selected resource
     }

     @Override
     public void onAccessDenied(BitwardsResource resource, int reasonCode) {
         // Access was denied for the selected resource
     }

     @Override
     public void onError(BitwardsResource resource, int errorCode) {
         // An error occurred while accessing the selected resource.
     }
 });

Logout end user

BitwardsService instance can be logged out from the backend server at anytime. After this, resources cannot be accessed anymore. login(BitwardsCredential, ResultCallback) must be called again in order to perform operations with resources.

 // Logout from backend server
 bws.logout(new BitwardsService.ResultCallback() {
     @Override
     public void onSuccess() {
         // Logout with the backend server was successful
     }

     @Override
     public void onError(int errorCode) {
         // Logout failed
     }
 });

Utility functions

Enable error reporting

Bitwards SDK is capable of reporting errors back to Bitwards servers, but this needs to be enabled when the application launches. Bitwards SDK uses its own error and crash reporting. When a crash occurs and error reporting is enabled, a notification is shown to the end user.

In order to send error reports, the following configuration parameters need to be added to module's build.gradle file:

 android {
     ...
     defaultConfig {
         ...
         // The URL where the error reports are sent (mandatory):
         manifestPlaceholders.bitwardsErrorReportUri = "<ERROR_REPORT_URL>"

         // If there is a need to add extra HTTP header for authorization, it can be
         // as described below.  ERROR_REPORT_HEADER should be in "<HEADER_NAME>: <HEADER_VALUE>" format.
         // Example: "X-Key: putHereTheSecretKey".
         manifestPlaceholders.bitwardsErrorReportHeader = "<ERROR_REPORT_HEADER>"
     }
     ...
 }

Error reporting is enabled during application runtime the following way:

 // Enable error reporting:
 BitwardsService.Debug.setErrorReporting(true);

Application can also configure Bitwards SDK to do deeper diagnostics, which means Bitwards SDK sends error reports more frequently. The diagnostics is enabled the following way:

 bws.setBitwardsConfig(new BitwardsConfig.Builder()
     .setBoolean(BitwardsConfig.DIAGNOSTICS_ENABLED, true)
     .setOverWrite(true)
     .build());

Error code to error string

Bitwards SDK has a lot of error codes. In order to get the textual representation for debugging purposes (and printed to logcat, for instance), the developer can use the following.

 // The error code returned by Bitwards SDK (example)
 int errorCode = 0;
 // The human-readable string representing the error code
 String errorText = BitwardsService.Debug.getErrorString(errorCode);
 // See the error code constants defined in BitwardsService for possible values

Getting error code from BitwardsException

The Bitwards error code can be obtained from Bitwards exception as follows:

 try {
     ...
 } catch (BitwardsException be) {
     int errorCode = be.getErrorCode();
     // process the error code
 }
  • Field Details

    • RESOURCE_SCAN_MODE_FULL

      public static final int RESOURCE_SCAN_MODE_FULL
      Bluetooth scan mode: scan for Bitwards resources will report all found resources, including unknown ones.
      See Also:
    • RESOURCE_SCAN_MODE_KNOWN

      public static final int RESOURCE_SCAN_MODE_KNOWN
      Bluetooth scan mode: scan for Bitwards resources will report only regular resources known by the logged in Bitwards end user.
      See Also:
    • RESOURCE_SCAN_MODE_UNIVERSAL

      public static final int RESOURCE_SCAN_MODE_UNIVERSAL
      Bluetooth scan mode: scan for Bitwards resources will report only universal resources known by the logged in Bitwards end user.
      See Also:
    • ERROR_BLUETOOTH_NO_PERMISSION

      public static final int ERROR_BLUETOOTH_NO_PERMISSION
      Bitwards resource error: Application does not have permission to use Bluetooth (needs access to permission).
      See Also:
    • ERROR_BLUETOOTH_NOT_ENABLED

      public static final int ERROR_BLUETOOTH_NOT_ENABLED
      Bitwards resource error: Bluetooth is not on in the device.
      See Also:
    • ERROR_BLE_SCAN_FAILED

      public static final int ERROR_BLE_SCAN_FAILED
      Bitwards resource error: Bluetooth scan failed.
      See Also:
    • ERROR_BAD_RESOURCE

      public static final int ERROR_BAD_RESOURCE
      Bitwards resource error: Resource is malfunctioning.
      See Also:
    • ERROR_GATT_ERROR

      public static final int ERROR_GATT_ERROR
      Bitwards resource error: Bluetooth GATT error occurred (try again).
      See Also:
    • ERROR_DEVICE_CONNECTION_ACTIVE

      public static final int ERROR_DEVICE_CONNECTION_ACTIVE
      Bitwards resource error: Bluetooth connection is already active.
      See Also:
    • ERROR_BLE_SCAN_ALREADY_ACTIVE

      public static final int ERROR_BLE_SCAN_ALREADY_ACTIVE
      Bitward resource error: Bluetooth scan is already active.
      See Also:
    • ERROR_BLE_NOT_RESOURCE

      public static final int ERROR_BLE_NOT_RESOURCE
      Bitwards resource error: Accessed bluetooth device is not a resource.
      See Also:
    • ERROR_NFC_NO_PERMISSION

      public static final int ERROR_NFC_NO_PERMISSION
      Bitwards resource error: Application does not have NFC permission.
      See Also:
    • ERROR_BLUETOOTH_WAS_DISABLED

      public static final int ERROR_BLUETOOTH_WAS_DISABLED
      Bitwards resource error: Bluetooth was disabled during operation.
      See Also:
    • ERROR_BAD_MAC_ADDRESS

      public static final int ERROR_BAD_MAC_ADDRESS
      Bitwards resource error: Bluetooth MAC address was invalid.
      See Also:
    • ERROR_RESOURCE_OUT_OF_RANGE

      public static final int ERROR_RESOURCE_OUT_OF_RANGE
      Bitwards resource error: resource was moved out of range.
      See Also:
    • ERROR_RESOURCE_DISCONNECTED

      public static final int ERROR_RESOURCE_DISCONNECTED
      Bitwards resource error: resource disconnected.
      See Also:
    • ERROR_RESOURCE_TIMEOUT

      public static final int ERROR_RESOURCE_TIMEOUT
      Bitwards resource error: connection to resource timed out.
      See Also:
    • ERROR_GATT_READ_FAILURE

      public static final int ERROR_GATT_READ_FAILURE
      Bitwards resource error: GATT characteristic read failure. This error should be treated as ERROR_BAD_RESOURCE.)
      See Also:
    • ERROR_FAILED_TO_SEND_LONG_RAPDU

      public static final int ERROR_FAILED_TO_SEND_LONG_RAPDU
      Device error: device not able to send long RAPDU message to the resource due to malfunctioning BLE in the device. Unfortunately, this error typically means that the App cannot access the resource in this device.
      See Also:
    • ERROR_RESOURCE_UNKNOWN_ERROR

      public static final int ERROR_RESOURCE_UNKNOWN_ERROR
      Bitwards resource error: unknown error occurred.
      See Also:
    • ERROR_UNKNOWN

      public static final int ERROR_UNKNOWN
      An unknown error occurred.
      See Also:
    • ERROR_NO_INTERNET

      public static final int ERROR_NO_INTERNET
      Device is not connected to internet.
      See Also:
    • ERROR_NOT_LOGGED_IN

      public static final int ERROR_NOT_LOGGED_IN
      Bitwards end user is not logged in, BitwardsService instanced is not connected to Bitwards backend environment.
      See Also:
    • ERROR_ALREADY_LOGGED_IN

      public static final int ERROR_ALREADY_LOGGED_IN
      Bitwards end user is already logged in, BitwardsService instance is already connected to Bitwards backend environment.
      See Also:
    • ERROR_LOGIN_FAILED

      public static final int ERROR_LOGIN_FAILED
      Login of the Bitwards end user to the Bitwards backend environment failed.
      See Also:
    • ERROR_LOGOUT_FAILED

      public static final int ERROR_LOGOUT_FAILED
      Logout of the logged in Bitwards end user from the Bitwards backend environment failed.
      See Also:
    • ERROR_CHANGE_PASSWORD_FAILED

      public static final int ERROR_CHANGE_PASSWORD_FAILED
      Password change of the logged in Bitwards end user failed.
      See Also:
    • ERROR_GET_USER_PROFILE_FAILED

      public static final int ERROR_GET_USER_PROFILE_FAILED
      Getting the profile of the logged in Bitwards end user failed.
      See Also:
    • ERROR_CHANGE_USER_PROFILE_FAILED

      public static final int ERROR_CHANGE_USER_PROFILE_FAILED
      Changing the profile of the logged in Bitwards end user failed.
      See Also:
    • ERROR_GET_RESOURCE_LIST_FAILED

      public static final int ERROR_GET_RESOURCE_LIST_FAILED
      Get the Bitwards resource list of the logged in Bitwards end user failed.
      See Also:
    • ERROR_INITIALIZATION_FAILED

      public static final int ERROR_INITIALIZATION_FAILED
      Initialization of BitwardsService instance failed.
      See Also:
    • ERROR_NOT_INITIALIZED

      public static final int ERROR_NOT_INITIALIZED
      BitwardsService instance is not initialized.
      See Also:
    • ERROR_ALREADY_INITIALIZED

      public static final int ERROR_ALREADY_INITIALIZED
      BitwardsService instance is already initialized.
      See Also:
    • ERROR_NOT_CONNECTED

      public static final int ERROR_NOT_CONNECTED
      BitwardsService instance is not connected.
      See Also:
    • ERROR_BLE_ALREADY_ACTIVE

      public static final int ERROR_BLE_ALREADY_ACTIVE
      An Bluetooth operation already active.
      See Also:
    • ERROR_LOGIN_FAILED_DUE_TO_SERVER_ERROR

      public static final int ERROR_LOGIN_FAILED_DUE_TO_SERVER_ERROR
      Login failed due to server error.
      See Also:
    • ERROR_CALLBACK_NULL

      public static final int ERROR_CALLBACK_NULL
      Callback is null.
      See Also:
    • ERROR_NO_LOCATION_PERMISSION

      public static final int ERROR_NO_LOCATION_PERMISSION
      Application does not have location permission (ACCESS_FINE_LOCATION).
      See Also:
    • ERROR_NO_NFC_PERMISSION

      public static final int ERROR_NO_NFC_PERMISSION
      Application does not have NFC permission.
      See Also:
    • ERROR_NO_READ_DEVICE_STATE_PERMISSION

      public static final int ERROR_NO_READ_DEVICE_STATE_PERMISSION
      Application does not have READ_DEVICE_STATE permission
      See Also:
    • ERROR_BLUETOOTH_NOT_AVAILABLE

      public static final int ERROR_BLUETOOTH_NOT_AVAILABLE
      Device does not support Bluetooth.
      See Also:
    • ERROR_NFC_NOT_AVAILABLE

      public static final int ERROR_NFC_NOT_AVAILABLE
      Device does not support NFC.
      See Also:
    • ERROR_BLE_SCAN_NOT_ACTIVE

      public static final int ERROR_BLE_SCAN_NOT_ACTIVE
      Bluetooth scan is not active.
      See Also:
    • ERROR_SECURE_DEVICE_LOCK_NOT_ENABLED

      @Deprecated public static final int ERROR_SECURE_DEVICE_LOCK_NOT_ENABLED
      Deprecated.
      Requirement of having device lock enabled has been removed from SDK, hence this error code has been deprecated.
      See Also:
    • ERROR_ANOTHER_OPERATION_ONGOING

      public static final int ERROR_ANOTHER_OPERATION_ONGOING
      Another operation is already ongoing.
      See Also:
    • ERROR_TIMEOUT

      public static final int ERROR_TIMEOUT
      Timeout occurred
      See Also:
    • ERROR_RESOURCE_NULL

      public static final int ERROR_RESOURCE_NULL
      BitwardsResource instance is null
      See Also:
    • ERROR_AUTH_TOKEN_EXPIRED

      public static final int ERROR_AUTH_TOKEN_EXPIRED
      Authentication token with the server has expired, sign in again needed.
      See Also:
    • ERROR_UNKNOWN_BACKGROUND_SCAN_MODE

      public static final int ERROR_UNKNOWN_BACKGROUND_SCAN_MODE
      Unknown background scan mode.
      See Also:
    • ERROR_INSTALLATION_NOT_ACTIVE

      public static final int ERROR_INSTALLATION_NOT_ACTIVE
      Installation is not active.
      See Also:
    • ERROR_INSTALLATION_ACTIVE

      public static final int ERROR_INSTALLATION_ACTIVE
      Installation is active.
      See Also:
    • ERROR_INSTALLATION_FAILED

      public static final int ERROR_INSTALLATION_FAILED
      Installation failed.
      See Also:
    • ERROR_RESOURCE_ALREADY_INSTALLED

      public static final int ERROR_RESOURCE_ALREADY_INSTALLED
      Installation failed because the resoruce was already installed.
      See Also:
    • ERROR_INSTALLATION_TASK_NOT_PENDING

      public static final int ERROR_INSTALLATION_TASK_NOT_PENDING
      Installation task is not in pending mode (it has been already performed)
      See Also:
    • ERROR_WRONG_INSTALLATION_TASK_CANCELLED

      public static final int ERROR_WRONG_INSTALLATION_TASK_CANCELLED
      Installation task to be cancelled was not the active one.
      See Also:
    • ERROR_INSTALLATION_TASK_CANCELLED

      public static final int ERROR_INSTALLATION_TASK_CANCELLED
      Installation task was cancelled
      See Also:
    • ERROR_SERVER_RESPONSE_RESOURCE_ALREADY_INSTALLED

      public static final int ERROR_SERVER_RESPONSE_RESOURCE_ALREADY_INSTALLED
      Installation failed because the Bitwards resource was already installed response by server.
      See Also:
    • ERROR_SERVER_RESPONSE_INTERNAL_ERROR

      public static final int ERROR_SERVER_RESPONSE_INTERNAL_ERROR
      Installation failed because internal error response by server.
      See Also:
    • ERROR_SERVER_RESPONSE_FAILED_TO_ADD_NEW_RESOURCE_IN_SERVER

      public static final int ERROR_SERVER_RESPONSE_FAILED_TO_ADD_NEW_RESOURCE_IN_SERVER
      Installation failed because server failed to new Bitwards resource response by server.
      See Also:
    • ERROR_SERVER_RESPONSE_SERIAL_NUMBER_ALREADY_EXISTS

      public static final int ERROR_SERVER_RESPONSE_SERIAL_NUMBER_ALREADY_EXISTS
      Installation failed because serial number already exists response by server.
      See Also:
    • ERROR_SERVER_RESPONSE_CANCEL_RESOURCE_RESERVATION_FAILED

      public static final int ERROR_SERVER_RESPONSE_CANCEL_RESOURCE_RESERVATION_FAILED
      Cancel Bitwards resource reservation failed response by server.
      See Also:
    • ERROR_CANCEL_RESOURCE_RESERVATION_SERVER_COMMUNICATION

      public static final int ERROR_CANCEL_RESOURCE_RESERVATION_SERVER_COMMUNICATION
      Cancel Bitwards resource reservation server communication error.
      See Also:
    • ERROR_SERVER_RESPONSE_RESOURCE_RESERVATION_FAILED

      public static final int ERROR_SERVER_RESPONSE_RESOURCE_RESERVATION_FAILED
      Bitwards resource reservation failed response by server.
      See Also:
    • ERROR_RESOURCE_RESERVATION_SERVER_COMMUNICATION

      public static final int ERROR_RESOURCE_RESERVATION_SERVER_COMMUNICATION
      Bitwards resource reservation server communication error.
      See Also:
    • ERROR_SERVER_RESPONSE_GET_LOCATION_LIST_FAILED

      public static final int ERROR_SERVER_RESPONSE_GET_LOCATION_LIST_FAILED
      Get location list failed response by server.
      See Also:
    • ERROR_GET_LOCATION_LIST_SERVER_COMMUNICATION

      public static final int ERROR_GET_LOCATION_LIST_SERVER_COMMUNICATION
      Get location list server communication error.
      See Also:
    • ERROR_REFRESH_FAILED

      public static final int ERROR_REFRESH_FAILED
      Refresh connection to server failed.
      See Also:
    • ERROR_INSTALLATION_TEST_FAILED

      public static final int ERROR_INSTALLATION_TEST_FAILED
      Testing access to the installed Bitwards resource failed, but installation was otherwise carried out successfully. All installation messages were delivered successfully, but testing the installation with test token failed.
      See Also:
    • ERROR_LOCATION_SERVICE_DISABLED

      public static final int ERROR_LOCATION_SERVICE_DISABLED
      Android device's Location service is disabled. It needs to be enabled in order to have Bluetooth scanning to work.
      See Also:
    • ERROR_RESOURCE_UPDATE_FAILED

      public static final int ERROR_RESOURCE_UPDATE_FAILED
      Update process of the Bitwards resource failed.
      See Also:
    • ERROR_RESOURCE_UPDATE_ACTIVE

      public static final int ERROR_RESOURCE_UPDATE_ACTIVE
      Another Bitwards resource update process is active.
      See Also:
    • ERROR_RESOURCE_UPDATE_TASK_CANCELLED

      public static final int ERROR_RESOURCE_UPDATE_TASK_CANCELLED
      Bitwards resource update task was cancelled.
      See Also:
    • ERROR_RESOURCE_UPDATE_NOT_ACTIVE

      public static final int ERROR_RESOURCE_UPDATE_NOT_ACTIVE
      Bitwards resource update process is not active.
      See Also:
    • ERROR_WRONG_RESOURCE_UPDATE_TASK_CANCELLED

      public static final int ERROR_WRONG_RESOURCE_UPDATE_TASK_CANCELLED
      Wrong Bitwards resource update task was cancelled.
      See Also:
    • ERROR_BACKGROUND_SCAN_STOPPED

      public static final int ERROR_BACKGROUND_SCAN_STOPPED
      Background scan was stopped manually.
      See Also:
    • ERROR_ACCESS_FORBIDDEN

      public static final int ERROR_ACCESS_FORBIDDEN
      The logged in end user does not have the permission to access the requested service.
      See Also:
    • ERROR_LOGIN_FAILED_BECAUSE_USER_DOES_NOT_EXISTS

      public static final int ERROR_LOGIN_FAILED_BECAUSE_USER_DOES_NOT_EXISTS
      Login failed because user does not exist.
      See Also:
    • ERROR_NO_BLUETOOTH_SCAN_PERMISSION

      public static final int ERROR_NO_BLUETOOTH_SCAN_PERMISSION
      The application does not have the BLUETOOTH_SCAN permission.
      See Also:
    • ERROR_NO_BLUETOOTH_CONNECT_PERMISSION

      public static final int ERROR_NO_BLUETOOTH_CONNECT_PERMISSION
      The application does not have the BLUETOOTH_CONNECT permission.
      See Also:
    • ERROR_ACCOUNT_DELETION_FAILED

      public static final int ERROR_ACCOUNT_DELETION_FAILED
      The application does not have the BLUETOOTH_CONNECT permission.
      See Also:
    • ERROR_RELOGIN_REQUIRED

      public static final int ERROR_RELOGIN_REQUIRED
      Logout reason: The refresh of the authentication token with OAuth2 failed because end user needs to re-login.
      See Also:
    • ERROR_USER_LOGGED_OUT

      public static final int ERROR_USER_LOGGED_OUT
      Logout reason: End user logged out.
      See Also:
    • REASON_HANDLE_IN_WRONG_POSITION

      public static final int REASON_HANDLE_IN_WRONG_POSITION
      Operation with Bitwards resource failed: handle is in wrong position
      See Also:
    • REASON_BAD_DATA

      public static final int REASON_BAD_DATA
      Operation with Bitwards resource failed: bad data.
      See Also:
    • REASON_WRONG_SIGNATURE

      public static final int REASON_WRONG_SIGNATURE
      Operation with Bitwards resource failed: bad signature.
      See Also:
    • REASON_WRONG_DELEGATION

      public static final int REASON_WRONG_DELEGATION
      Operation with Bitwards resource failed: wrong delegation.
      See Also:
    • REASON_DELEGATION_USED

      public static final int REASON_DELEGATION_USED
      Operation with Bitwards resource failed: delegation used.
      See Also:
    • REASON_DELEGATION_CACHE_OVERRUN

      public static final int REASON_DELEGATION_CACHE_OVERRUN
      Operation with Bitwards resource failed: delegation cache overrun.
      See Also:
    • REASON_TOKEN_BLACKLISTED

      public static final int REASON_TOKEN_BLACKLISTED
      Operation with Bitwards resource failed: token is blacklisted.
      See Also:
    • REASON_WRONG_TIME_WINDOW

      public static final int REASON_WRONG_TIME_WINDOW
      Operation with Bitwards resource failed: token has wrong time window.
      See Also:
    • REASON_CREATIONTIME_IN_FUTURE

      public static final int REASON_CREATIONTIME_IN_FUTURE
      Operation with Bitwards resource failed: token creation time in future.
      See Also:
    • REASON_RESOURCE_ALREADY_RESERVED

      public static final int REASON_RESOURCE_ALREADY_RESERVED
      Operation with Bitwards resource failed: resource is already reserved.
      See Also:
    • REASON_ILLEGAL_USER_ROLE

      public static final int REASON_ILLEGAL_USER_ROLE
      Operation with Bitwards resource failed: token owner has illegal user role.
      See Also:
    • REASON_PERIPHERAL_FAILURE

      public static final int REASON_PERIPHERAL_FAILURE
      Operation with Bitwards resource failed: peripheral failure occurred.
      See Also:
    • REASON_PERIPHERAL_COMMUNICATION_FAILURE

      public static final int REASON_PERIPHERAL_COMMUNICATION_FAILURE
      Operation with Bitwards resource failed: peripheral communication failure occurred.
      See Also:
    • REASON_OPERATION_FAILED_BATTERY_CRITICAL

      public static final int REASON_OPERATION_FAILED_BATTERY_CRITICAL
      Operation with Bitwards resource failed: operation failed due to resource's battery being critical.
      See Also:
    • REASON_OPERATION_DENIED_BY_REGULAR_SCHEDULE

      public static final int REASON_OPERATION_DENIED_BY_REGULAR_SCHEDULE
      Operation with Bitwards resource failed: access denied due to regular schedule access list.
      See Also:
    • REASON_OPERATION_DENIED_BY_EXCEPTION_SCHEDULE

      public static final int REASON_OPERATION_DENIED_BY_EXCEPTION_SCHEDULE
      Operation with Bitwards resource failed: access denied due to exception schedule.
      See Also:
    • REASON_NO_VALID_TOKEN

      public static final int REASON_NO_VALID_TOKEN
      Operation with Bitwards resource failed: application does not have have a valid token for the resource.
      See Also:
    • ERROR_RESOURCE_REQUIRES_APP_UPDATE

      public static final int ERROR_RESOURCE_REQUIRES_APP_UPDATE
      Operation with Bitwards resource failed: application does not support the protocol resource is using, application update is required.
      See Also:
  • Method Details