Connect Lovense Toys.
Pass your token into 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()).addListener(toyId, new OnCallBack() {});
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);