Got Stuck?
Forum for Lovense Developers
Click to explore the release pose for Android SDK
Support
Document Feedback

Android SDK

The Lovense Android SDK is a set of application interfaces based on Android 4.3 and above. Use this SDK to develop applications for Android mobile devices. By calling the Lovense SDK interface, you can easily control Lovense toys and build applications with rich functions and strong interactivity.

Download Demo

Step 1: Get the developer token

Go to the developer dashboardopen in new window and get your developer token.

Step 2: Download and extract the Lovense SDK

Download SDK

Step 3: Include SDK and Configure

  1. Copy the following file to your libs directory.

    Lovense Android SDK Path

  2. Add lovense.arr to your app build.gradle. Configure libs in the program build.gradle.

    app build.gradle:

    implementation files ('libs/lovense.aar')

    program build.gradle:

    Lovense Android SDK build config

  3. Configure permissions and register service in AndroidManifest.xml

    • Permission list

      <uses-permission android:name="android.permission.INTERNET" />
      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
      <uses-permission android:name="android.permission.BLUETOOTH" />
      <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
      <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
      <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
      
    • Register service

      <service android:name="com.xtremeprog.sdk.ble.BleService" android:enabled="true" />
      

Step 4: Connect Lovense toys and send commands


// Pass your token into the Lovense framework
Lovense.getInstance(getApplication()).setDeveloperToken("Your token");

// Add a scan success notification
Lovense.getInstance(getApplication()).searchToys(new OnSearchToyListener() {
  @Override
  public void onSearchToy(LovenseToy lovenseToy) { } // Find toys

  @Override
  public void finishSearch() { }  // Scan finish

  @Override
  public void onError(LovenseError msg) { } // error

});

//Add a connection success notification
Lovense.getInstance(getApplication()).connectToy(toyId, new OnConnectListener() {
  @Override
  public void onConnect(String toyId,String status) { // Toy connection status
    switch (status) {
      case LovenseToy.STATE_CONNECTING:
        break;
      case LovenseToy.STATE_CONNECTED:
        break;
      case LovenseToy.STATE_FAILED:
        break;
      case LovenseToy.SERVICE_DISCOVERED:
        break;
    }
  }
  @Override
  public void onError(LovenseError lovenseError) {} // Connection error
 });

// Add sending command notification
Lovense.getInstance(getApplication()).addListener(toyId, new OnCallBack() {});

// Search for the toys over Bluetooth
Lovense.getInstance(getApplication()).searchToys(new OnSearchToyListener());

//Stop searching for toys
Lovense.getInstance(getApplication()).stopSearching();

// Save the toys
Lovense.getInstance(getApplication()).saveToys(lovenseToys, new OnErrorListener());

// Retrieve the saved toys
Lovense.getInstance(getApplication()).listToys(new OnErrorListener());

// Connect the toy
Lovense.getInstance(getApplication()).connectToy(toyId,new OnConnectListener());

// Disconnect the toy
Lovense.getInstance(getApplication()).disconnect(toyId);

// Send a command to the toy
Lovense.getInstance(getApplication()).sendCommand(toyId,LovenseToy.COMMAND _VIBRATE,vibrateLevel);

Command list

CommandDescription
COMMAND_VIBRATEVibrate the toy. The parameter must be between 0 and 20.
COMMAND_ROTATERotate the toy. The parameter must be between 0 and 20.
COMMAND_ROTATE_CLOCKWISERotate clockwise. The parameter must be between 0 and 20.
COMMAND_ROTATE_ANTI_CLOCKWISERotate anti-clockwise. The parameter must be between 0 and 20.
COMMAND_ROTATE_CHANGEChange the rotation direction
COMMAND_AIR_INAirbag inflation for n seconds. The parameter must be between 1 and 3.
COMMAND_AIR_OUTAirbag deflation for n seconds. The parameter must be between 1 and 3.
COMMAND_AIR_AUTOCycle airbag inflation for n seconds and air deflation for n seconds. The parameter must be between 0 and 3 (0 means stop).
COMMAND_VIBRATE1Activate the first vibrator at level n. The parameter must be between 0 and 20.
COMMAND_VIBRATE2Activate the second vibrator at level n. The parameter must be between 0 and 20.
COMMAND_VIBRATE_FLASHVibrate the toy at level n and flash the light at the same time.
COMMAND_FLASHFlash the light 3 times
COMMAND_LIGHT_OFFTurn off the light (saved permanently).
COMMAND_LIGHT_ONTurn on the light (saved permanently).
COMMAND_GET_LIGHT_STATUSGet the light's status (1: on, 0: off)
COMMAND_ALIGHT_OFFTurn off Domi/Domi 2 light (saved permanently)
COMMAND_ALIGHT_ONTurn on the Domi/Domi 2 light (saved permanently)
COMMAND_GET_ALIGHT_STATUSGet the Domi/Domi 2 light status (1: on, 0: off)
COMMAND_GET_BATTERYGet battery status
COMMAND_GET_DEVICE_TYPEGet device/toy information
COMMAND_START_MOVEStart tracking the toy movement (0-4)
COMMAND_STOP_MOVEStop tracking the toy movement
COMMAND_PRESETVibrate with a preset pattern. Patterns range from 1 to 10. n=0 will stop vibrations.
COMMAND_FLEXER_VIBRATEControl the vibration of Flexer. The parameter must be between 0 and 20.
COMMAND_FLEXER_FINGERControl the fingering motion of Flexer. The parameter must be between 0 and 20.
COMMAND_VIBRATE3Activate the third vibrator at level n. The parameter must be between 0 and 20.
COMMAND_THRUSTThrust the toy. The parameter must be between 0 and 20.
COMMAND_MULTIPLYControl three vibrators with different strength level for Lapis. Level range is 0 - 20, set level to -1 for remaining strength level from previous function.
COMMAND_SOLACEControl thrust and depth level separately for Solace. Level range is 0 - 20 for thrusting, and 1-3 for depth. Set level to 0 for thrusting will make the toy stop no matter what is the level value for depth. If the depth is not specified, the toy will act with the set thrusting level and default depth level value 1.

Callback list

CallbackDescription
OnSearchToyListenerFound toy list
OnConnectListenerToy connected status
OnSendCommandErrorListenerSend Command error, extends OnCallBack
OnCallBackBatteryListenerBattery status, extends OnCallBack
OnCallBackDeviceTypListenerDevice information, extends OnCallBack
OnCallBackLightStatusListenerLight indicator, extends OnCallBack
OnCallBackAidLightStatusListenerDomi/Domi 2 light indicator, extends OnCallBack
OnCallBackMoveListenerToy movement updates, extends OnCallBack
OnCommandSuccessListenerCommand success, extends OnCallBack
OnCommandErrorListenerCommand Error, extends OnCallBack