VROEMService Tutorials

List

Setup the Build Environment

  • Make sure Android Studio is installed.
  • Make sure to use Android API Level 23 or later.
  • Download and import the VIVE Wave™ VROEMservice (wvr_oemlib.aar).
  • Add the required libraries in build.gradle.

VROEM Library Reference

The interfaces and classes in VROEM library (wvr_oemlib.aar) are the bridge of communication between VIVE Wave™ Server and VROEMservice. For developers, you can reference the definition of these items in VROEM library.

Declare VROEMService

  1. Write AndroidManifest.xml

    You need to declare the action of VROEMservice in its AndroidManifest.xml, so that the VIVE Wave™ Server will find it.

    <intent-filter>
        <action android:name="android.intent.action.VROEMSERVICE" />
    </intent-filter>
    

    Note

    Make sure that there is only one VROEMService installed on your device, or the VIVE Wave™ Server might choose wrong one to use.

  2. Implement : IVROEMService

    Write an Android service and extend IVROEMService.

    • onBind: must return the IBinder of IVROEMService.
    • getMinApiVersion
    • getMaxApiVersion
    • getApi: must return the IBinder of IVROEMService_api1
    private VROEMService_api1 mServiceApi1;
    
    private final IVROEMService.Stub mBinder = new IVROEMService.Stub() {
        @Override
        public int getMinApiVersion() throws RemoteException {
            return 1;
        }
    
        @Override
        public int getMaxApiVersion() throws RemoteException {
            return 1;
        }
    
        @Override
        public IBinder getApi(int version) throws RemoteException {
            switch (version) {
                case 1:
                    return mServiceApi1;
            }
            return null;
        }
    };
    
    @Override
    public IBinder onBind(Intent intent) {
        Log.d(TAG,"onBind");
        return mBinder;
    }
    
  3. Implement: IVROEMService_api1

    This is the core of VROEMservice. It receives events and gets infromation from VIVE Wave™ Server, you can customize your own features. And we implement IVROEMClient_api1 in VIVE Wave™ Server, thus they can communicate with each other.

    VROEMservice can do some environment checking when VR app is launching. And it returns the VRValidationResult to VIVE Wave™ Server. The VRValidationResult is generated after finishing whole environment checking.

    There are two situations of returning the VRValidationResult. VROEMservice may spend more time to do whole checking when launching first VR app. It just returns the VRValidationResult when launching VR app subsequently.

1). First VR app is launching

VROEMservice does complete environment checking and it may spend more time. VROEMservice returns the result to VIVE Wave™ Server through broadcastServerReady().

Below is the calling sequence of launching first VR app:

_images/VROEMService_FirstVRAPInit.png

2). Non-first VR app is launching

When VR apps launches subsequently, VROEMservice returns the VRValidationResult that is generated by launching first VR app.

Below is the calling sequence of launching non-first VR app:

_images/VROEMService_NonFirstVRAPInit.png

Simple VROEMService

VIVE Wave™ provides a sample VROEMservice in SDK/samples/SimpleOEMService. You can reference it to add your own features. This simple OEMService has these functions:

  • Receive data and events from VIVE Wave™ Server
  • Check the environment of device and return validation result to VIVE Wave™ Server
  • Trigger recenter of controller when pressing system button of VR controller