Native SDK

iOS SDK

The Lovense iOS SDK is a set of application interfaces based on iOS 8.0 and above. Use this SDK to develop applications for iOS 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 your 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 the SDK in your project

Copy the following files to your project main directory.

Add the required framework Lovense.framework to your project.

Link Lovense IOS SDK

Configure environment: TARGETS -> General -> Deployment Info -> Deployment Target -> setting 8.0 or above.

Step 4: Connect Lovense toys and send commands

// import Lovense
#import <Lovense/Lovense.h>

// Pass your token into the Lovense framework
[[Lovense  shared] setDeveloperToken:@"Your token"];

// Add a scan success notification
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(scanSuccessCallback:)
name:kToyScanSuccessNotification object:nil];      //Scanning toy success notification
-(void)scanSuccessCallback:(NSNotification *)noti
{
    NSDictionary * dict = [noti object];
    NSArray <LovenseToy*>* toys = [dict objectForKey:@"scanToyArray"];
}

// Add a connect success notification

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(connectSuccessCallback:)
name:kToyConnectSuccessNotification object:nil];     //Connected toy successfully notification
-(void)connectSuccessCallback:(NSNotification *)noti
{
    NSDictionary * dict = [noti object];
    LovenseToy * toy = [dict objectForKey:@"toy"];
    NSLog(@"%@",toy);
}

// Search for the toys over Bluetooth
[[Lovense  shared] searchToys];

// Save the toys
[[Lovense  shared] saveToys:toys];

// Retrieve the saved toys
NSArray<LovenseToy*> * listToys = [[Lovense  shared] listToys];

// Connect the toy
[[Lovense shared] connectToy:toyId];

// Disconnect the toy
[[Lovense shared] disconnectToy:toyId];

// Send a command to the toy
[[LovenseBluetoothManager shared] sendCommandWithToyId:toyId
andCommandType:COMMAND_VIBRATE andParamDict:@{kSendCommandParamKey
_VibrateLevel:@(20)}];

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Create YourProjectName-Bridging-Header.h

// Import Lovense
#import <Lovense/Lovense.h>

// Pass your token into Lovense framework
Lovense.shared().setDeveloperToken("token")

//Add a scan success notification
NotificationCenter.default.addObserver(self, selector: #selector(scanSuccessCallback),
name: NSNotification.Name(rawValue: kToyScanSuccessNotification), object: nil)
//Scanning toy success notification
@objc func scanSuccessCallback(nofi : Notification)
{
    let dict = nofi.object as? [String, LovenseToy]
    let scanToyArr = dict?["scanToyArray"]
}

//Add a connect success notification
NotificationCenter.default.addObserver(self, selector: #selector(connectSuccessCallback),
name: NSNotification.Name(rawValue: kToyConnectSuccessNotification), object: nil)
//Connected toy successfully notification
@objc func connectSuccessCallback(nofi : Notification)
{
    let dict = nofi.object as? [LovenseToy]
    let toy = dict?["toy"]
}

// Search the toys over Bluetooth
Lovense.shared().searchToys()

//Save the toys
Lovense.shared().save(toys)


// Retrieve the saved toys
Lovense.shared().listToys()

// Connect the toy
Lovense.shared().connectToy("toyId")

// Disconnect the toy
Lovense.shared().disconnectToy("toyId")

// Send a command to the toy
Lovense.shared().sendCommand(withToyId: "ToyId",
andCommandType: COMMAND_VIBRATE,
andParamDict: [kSendCommandParamKey_VibrateLevel:20])
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

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.

Callback list

CallbackDescription
kToyScanSuccessNotificationFound toys
kToyConnectSuccessNotificationToy connected
kToyConnectFailNotificationFailed to connect a toy
kToyConnectBreakNotificationToy disconnection
kToySendCommandErrorNotificationUnknown command received
kToyCallbackNotificationBatteryBattery status
kToyCallbackNotificationDeviceTypeDevice information
kToyCallbackNotificationGetLightStatusLight indicator
kToyCallbackNotificationGetAidLightStatusDomi/Domi 2 light indicator
kToyCallbackNotificationListenMoveToy movement updates
kToyCommandCallbackNotificationAtSuccessSuccessful command
kToyCommandCallbackNotificationAtErrorCommand error

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" />
      
      1
      2
      3
      4
      5
      6
    • Register service

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

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);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

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.

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

Windows SDK

The Windows SDK is a library provided for Windows that allows you to directly access Lovense toys. You usually choose this option if you are making your own Windows application.

Download Demo

Step 1: Get your developer token

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

Note: You need to fill in your developer token when using the SDK.

Step 2: Download SDK

Download SDK

Step 3: Configure the SDK in your application

For example, the method below is to configure SDK in Visual Studio 2019

  1. Set the path of the SDK header file

    configure head

  2. Set the path of SDK lib file

    configure libs

Step 4: Connect Lovense toys and send commands

#include <Lovense.h>
...
class CEventCallBack: public ILovenseSDKNotify
{
	public:
		/*Call when toy search start*/
		virtual	void LovenseDidSearchStart();

		/*Call when toy searching toy*/
		virtual  void LovenseSearchingToys(lovense_toy_info_t *info) = 0;

		/*Call when something went wrong*/
		virtual  void LovenseErrorOutPut(int errorCode,const char *errorMsg) = 0;


		/*Call when toy search end*/
		virtual  void LovenseDidSearchEnd();

		/*Call when send cmd start*/
		virtual	void LovenseDidSendCmdStart();

		/*Call when send cmd return*/
		virtual  void LovenseSendCmdResult(const char * szToyID, CLovenseToy::CmdType cmd,const char *result,CLovenseToy::Error errorCode);

		/*Call when send cmd end*/
		virtual	void LovenseDidSendCmdEnd();

		/*Call when toy connected, or disconnected*/
		virtual void LovenseToyConnectedStatus(const char *szToyID, bool isConnected) ;
};

...
	//TODO:This is a simple process
	CEventCallBack *callBack = new CEventCallBack();
	CLovenseToyManager *manager = GetLovenseToyManager();
	manager->SetDeveloperToken(...);
	manager->RegisterEventCallBack(callBack);
	manager->StartSearchToy();//Search for the toys via USB Dongle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

Send a command

	CLovenseToyManager *manager = GetLovenseToyManager();
	//Send a vibration command
	manager->SendCommand(toyID,CLovenseToy::CmdType::COMMAND_VIBRATE,10);

1
2
3
4

For a list of supported commands, check LovenseDef.h

namespace CLovenseToy
{
	typedef enum {

		/**
		-Power off!
		- param Key = no parameter
		*/
		COMMAND_POWER_OFF = 100,

		/**
		- Vibrate the toy. The parameter must be between 0 and 20!
		- Supported toys = all
		*/
		COMMAND_VIBRATE = 101,

		/**
		- Rotate the toy. The parameter must be between 0 and 20!
		- Supported toys = Nora
		*/
		COMMAND_ROTATE = 102,
		.
		.
		.
	}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

Setup

  1. Insert the Lovense USB Bluetooth Adapter into the PC.
  2. Turn on the toy. The light will begin flashing.
  3. Open your application and search for the toy to establish a connection.

Tips

  1. When searching for toys, do not send other commands to toys.
  2. If you need to get the toy's battery level frequently, start a thread loop.
  3. For best results, don't sent toy commands more than once per second.
  4. First time users, refer to our SDK Demo linked above.

View log output

To view log output, use the editbin command.

Note: If there is an "editbin not found" error when compiling, here is a solutionopen in new window.

view log

Last Updated: 2/21/2023, 7:15:06 PM