Skip to main content

Access Point

Getting list of access points

note

This snippet of the code explains how to get all the devices to which a particular user has permission to.

PermissionManager permissionManager =
serviceProvider.getPermissionManager();
List<AccessPoint> accessPoints = permissionManager.getAccessPoints();
// This is a list of doors the user has access to.
//To get access point from its id
String id = "some_id"
AccessPoint accessPoint = permissionManager.getAccessPoint(id);
//This will return null if no matching access point was found;
//To get access points of a specific organisation
String orgId = "some_id"
List<AccessPoint> accessPoints =
permissionManager.getAccessPointsOfOrganisation(orgId);
// To get update of when this list changes, attach an observer returned by
the following function
Observable observable =
permissionManager.getAccessPointsUpdateObservable();
Observer observer = (observable, o) -> {
//Refetch the access points to keep yourself updated
List<AccessPoint> accessPoints = permissionManager.getAccessPoints();
});
observable.addObserver(observer);
//OR observe on androidx livedata
permissionManager.getAccessPointsLiveData().observe(this, accessPoints ->
{
//Use the accessPoints as needed
});
//This example is shown with lambda used in java 1.8. If you are using 1.7
then use anonymous class
instead
//NOTE: Remove the observer once you no longer require to avoid memory
leaks
class AccessPoint {
String id;
//Id of access point. Use this value to unlock access point
List<String>;
//Ids of organisations the access point belongs to
String name;
//Name of the access point
List<String> deviceTags;
//Attached devices to access point (entry/exit)
boolean hasRemoteAccessPermission;
//Indicates wether user has permission to unlock this
//access point over internet
boolean hasProximityAccessPermission;
//Indicates wether user has permission to unlock this
//access point while walking towards it.
boolean hasTapToAccessPermission;
//Indicates wether user has permission to unlock this
//access point while walking towards it.
boolean hasClickToAccessPermission;
//Indicates wether user has permission to unlock this
//access point while when user requests it (app explicitly requestsbleUnlock).