loadOfflineFile(params: Object)

Requires:
WearKit≥1.1.3@ray-js/ray≥1.7.82
Platforms:
iOSAndroid
import { wear } from '@ray-js/ray';

const { loadOfflineFile } = wear;

// Promise usage
try {
  const res = await loadOfflineFile({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

Description

Download offline file.

Parameters

PropertyTypeRequiredDescription
deviceIdstringYesDevice ID
channelnumberYest.Integer; Select channel 0: Unspecified 1: BLE 2: AP
sessionIdnumberYes0 indicates starting a new task; task ID
complete() => voidNoCompletion callback (executed on both success and failure)
NoCallback on successful API call
fail(params: Object) => voidNoFailure callback
fail callback parameters
PropertyTypeDescription
errorMsgstringError message
errorCodestring | numberError code
Error extension

Return Value

None

Error Code

Error CodeError Message
10001Internal error
10090Failed to get offline file list
10091Failed to enable hotspot
10092Failed to connect to hotspot
10093Failed to get hotspot routing
10094Wi-Fi permission not enabled
10095Abnormal transfer rate (speed is 0 for 10s continuously)
10096Wi-Fi hotspot connection has been disconnected
10300Hotspot has been connected by another device
10301Check Wi-Fi permission/LAN/network
10302VPN enabled or AP channel is occupied
10303AP connection timed out, please restart the device
10304Cannot connect when the app is in the background
10305Authorization error

Examples

Basic usage

import { wear } from '@ray-js/ray'

wear.loadOfflineFile({
  deviceId: 'device123',
  channel: 1,
  sessionId: 0,
  success: (taskId) => {
    console.log('loadOfflineFile success', taskId);
  },
  fail: error => {
    console.error(error);
  },
});