PostBoxController

PostBoxController

With the PostBoxController you can observe NearbyPostBox‘es.

postBoxController.getNearbyPostBoxes("unitId").collect { nearbyBoxes: List<NearbyPostBox> ->
    // ...
}

Once you got a NearbyPostBox you can open it. For integration reasons you must pass an instance of Application.

postPostController.open(nearbyPostBox, application)
    .onSuccess {
        // ...
    }
    .onError {
        // ...
    }

Every NearbyPostBox contains a PostBox, which can be either a LetterPostBox or a ParcelPostBox.

If the PostBox is of type LetterPostBox you do not need to set any PostBoxCredentials. But if it is a ParcelPostBox you must set the PostBoxCredentials before you wanna open that NearbyPostBox.

The reason is data privacy. We (Sensorberg) are not allowed to store the credentials for a ParcelPostBox. So you have to handle this on your side and setting them before opening them.

Our SDK is Kotlin and Coroutines first. So the main API will offer suspend functions or return Flow. We also provide support functions that uses Callback API or LiveData in case you can not use Coroutines (or even Kotlin).