Change from Unit to String

            .onEnter(new Function1<ProximityZoneContext, Unit>() {
                @Override
                public Unit invoke(ProximityZoneContext proximityZoneContext) {
                    beaconValue = proximityZoneContext.getAttachments().get("desk-owner");
                    return null;;
                }
            })
            .build();
    proximityObserver.startObserving(zone);

so for this code, I actually want to return something in the invoke function but Unit is implicit meaning it does not actually return anything, is there anyway to change this part of code from Unit to String correctly.
Thank you

Create a field in your class and then assign a value to it inside callback. You can also invoke a method and pass value of an attachment to it.
Idea behind callback is that it is supposed to invoke some kind of action, like show notification, send data to cloud etc. It is not supposed to return any value because calling entity would not know what to do with it. Unit and return null; is only there to make that Java code compatible with Kotlin.