startImport(params: Object)

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

const { startImport } = wear;

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

Description

Trigger file import.

Parameters

PropertyTypeRequiredDescription
complete() => voidNoCompletion callback (executed on both success and failure)
success() => voidNoCallback 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
20101Number of imported files exceeds the limit (10)
20102File too large
20103Invalid file format
20104Insufficient storage
20105File does not exist
20106File attributes changed
20107File duration too long
20108SDK initialization failed
20109Failed to start audio decoding
20110File format error; cannot decode
20111Decoding interrupted due to file error
20112Import task interrupted unexpectedly
20113Failed to create MP3
20114User canceled import

Examples

Basic usage

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

wear.startImport({
  success: () => {
    console.log('startImport success');
  },
  fail: error => {
    console.error(error);
  },
});