startCompass(params: Object)

Requires:
BaseKit≥2.3.2@ray-js/ray≥0.3.23
Platforms:
iOSAndroid
import { startCompass } from '@ray-js/ray';

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

Description

Start listening to compass data

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

Examples

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

// Start listening to the compass sensor
startCompass({
  success: () => console.log("Started listening to the compass"),
  fail: error => console.error(error),
});