MoonsenseCallback

interface MoonsenseCallback

Use this callback to gather feedback from the Moonsense SDK during normal operation.

Keep track of the returned error messages for useful information about problems encountered by the SDK when performing the requested tasks.

Note that the MoonsenseCallback can only be registered on a thread with a Looper (for eg. the Main Thread). If the callback is registered on a thread with no Looper then no callback methods will be returned back to the user.

Functions

Link copied to clipboard
abstract fun onError(ex: Exception)

Any errors/exceptions encountered by the SDK are reported to the caller via this callback.

Link copied to clipboard
abstract fun onSessionStarted(session: Session)

Lets the caller know when a session has been started.

Link copied to clipboard
abstract fun onSessionStopped(session: Session)

Lets the caller know when a session has stopped.

Link copied to clipboard
open fun onTargetElement(targetElementId: String, view: View): Map<String, String>?

The Moonsense SDK tracks individual View's as TargetElements. Implement this method to provide additional attributes to the TargetElement using the provided View. The attributes provided would be associated with each Session that uses the TargetElement with the targetElementId. The data would be available via a Custom Event generated by the SDK with the event name "targetElementCreated". The targetElementId can be found in the Custom Event key.