Lens Scripting API

    Class DeviceInfoSystem

    Provides information about the device running the Lens. Accessible through global.deviceInfoSystem.

    var osType = global.deviceInfoSystem.getOS();
    var isMobile = (osType == OS.iOS || osType == OS.Android);

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    onInternetStatusChanged: event1<InternetStatusChangedArgs, void>

    Triggered when internet availability changed.

    Example js

    // @input Component.Text textObject

    global.deviceInfoSystem.onInternetStatusChanged.add(function(eventData) {
    script.textObject.text = eventData.isInternetAvailable
    ? "UPDATED: Internet is available"
    : "UPDATED: No internet";
    });

    Example ts

    @component
    export class NewScript extends BaseScriptComponent {
    @input textObject: Text;

    onAwake() {
    this.textObject.text = global.deviceInfoSystem.isInternetAvailable()
    ? "Internet is available"
    : "No internet";

    global.deviceInfoSystem.onInternetStatusChanged.add((args) => {
    this.textObject.text = args.isInternetAvailable
    ? "UPDATED: Internet is available"
    : "UPDATED: No internet";
    });
    }
    }
    screenScale: number

    Specifies the device pixel ratio. Can be used to set rendering at the real screen resolution.

    Methods

    • Exposes User Data

      Returns the operating system type of the device.

      Returns OS

    • Experimental Wearable Only

      Get the DeviceCamera object for the given camera ID which provides intrinsics/extrinsics of the camera.

      Parameters

      Returns DeviceCamera

    • Returns boolean

    • Returns whether the current Lens is running in a desktop computer.

      Returns boolean

    • Returns whether the current Lens is running in Lens Studio.

      Returns boolean

    • Returns true if the device has access to the internet.

      Example js

      // @input Component.Text textObject

      script.textObject.text = global.deviceInfoSystem.isInternetAvailable()
      ? "Internet is available"
      : "No internet";

      Example ts

      @component
      export class NewScript extends BaseScriptComponent {
      @input textObject: Text;

      onAwake() {
      this.textObject.text = global.deviceInfoSystem.isInternetAvailable()
      ? "Internet is available"
      : "No internet";
      }
      }

      Returns boolean

    • Returns whether the current Lens is running in a mobile device.

      Returns boolean

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean

    • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

      Parameters

      Returns boolean

    • Returns whether the current Lens is running in a Spectacles device.

      Returns boolean

    • Accepts a callback which indicates whether the current device is capable of providing both front and rear camera texture simultaneously.

      Parameters

      • callback: (supportsDualCamera: boolean) => void

      Returns void

    MMNEPVFCICPMFPCPTTAAATR