Opening the Doors
Spintly provides 3 options to open the doors
- Click to Access: Listing all the doors in the UI, and clicking on a specific door
- Tap to Access: Here user just needs to tap the phone on the unit and the door will open
- Proximity Access: here the phone needs to be within the proximity of the device
note
For tap to access and proximity functionalities, developers are relieved of any additional coding burden in the app. These features can be effortlessly enabled or disabled directly in the backend settings. However, if developers intend to list doors and implement the click-to-access feature, they should utilize the provided snippet for seamless door management and access control.
UnlockCallback callback = new UnlockCallback() {
@Override
public void onDeviceFound(String accessPointid, String tag) {
// To indicate which device was selected to open since a single access
point
// can have multiple devices attached to it.
// Currently these tags are "entry" and "exit".
// This callback can be ignored.
}
@Override
public void onSuccess(String accessPointid, String tag, byte
customParameter) {
// success.
// customParameter that was passed.
// If nothing was passed this value will be 0x00
}
@Override
public void onFailure(Exception exc) {
// error
}
});
AccessPoint requestedPoint = accessPoints.get(n); // Requested access to a
specific access
point
AccessManager accessManager = serviceProvider.getAccessManager();
accessManager.bleUnlockAccessPoint(requestedPoint.id, callback);
//If you would like to add a custom parameter you can add it the following
way
byte customParameter = (byte) 1; (between 0 to 255)
// 1 byte unsigned int custom parameter can be added to send in access
history.
accessManager.bleUnlockAccessPoint(requestedPoint.id, customParameter,
callback);
// Only one unlock at a time is supported as of this moment so please avoid calling this function again without the previous one returningsuccess/error.
Proximity Access:
//This step is optional. Proximity unlock will occur regardless of setting
this callback
//If you need to observe every proximity unlock then add this step in
application onCreate()
AccessManager accessManager = serviceProvider.getAccessManager()
accessManager.setProximityCallback(new ProximityCallback() {
@Override
public void onSuccess(String accessPointId, String tag) {
//Handle success as needed
}