Custom Event Metadata

Custom event metadata is a feature which is available in the Bluedot Point SDK for our customers to set additional event-specific metadata to our Check-in and Check-out Notifications which is sent to Bluedot backend.

Usage:

It can be used by application developers to send any user/device-specific information like UserID, DeviceID, etc. along with the Check-in/Check-out events.

When to Set:

You can set custom event metadata in the Application (not in Activity/ViewController) before authenticating Bluedot SDK and anytime when the metadata value may change.

image

If you are setting the metadata in the custom action callbacks of Check-in and Check-out, it will be sent in the next Check-in/Check-out event to the backend as previous events are already processed from Bluedot SDK.

The custom event metadata should be set before the check-in and check-out event is processed and it is suggested to not set it on the callbacks for custom action. As check-in events may occur immediately upon authentication, it is recommended that custom event metadata be set before authentication, if possible. If the metadata is set as part of the custom action callback, then it will be sent as part of the next check-in/check-out.

image

The custom event metadata is not persisted across SDK sessions. If the SDK is logged out the custom event metadata is cleared by the SDK. We suggest setting the custom data before every SDK authentication in the app.

How to implement it on Android

Create a HashMap of Key (String) and Value (String) pair. You can set the metadata you wish to pass along the check-in/check-out events in it.

Refer example code as below:

class TestApplication extends Application
{
    @Override
    public void onCreate() {
        ...
        Map<String, String> metaData = new HashMap<>();
        metaData.put("DeviceName", getDeviceName());

        // Setting metaData object in setCustomEventMetaData with BlueDotPointService.
        getServiceManager().setCustomEventMetaData(metaData);

        // Authenticate.
        getServiceManager().sendAuthenticationRequest(apiKey, listener, restartMode)
    }
}

Detailed Info can be found in respective SDK API docs here.

How to implement it on iOS

Set a Key-Value pair for CustomEventMetaData. Refer Example code as below:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Boo {
    ...
    
    // Setting meta data in setCustomEventMetaData.
    BDLocationManager.instance()?.setCustomEventMetaData(["DeviceName" : UIDevice.current.name])

    // Authenticate.
    BDLocationManager.instance()?.authenticate(withApiKey: "Your assigned Bluedot API Key", requestAuthorization: .authorizedAlways)

    ...
 
    return true
}

This metadata will be sent along with the Check-in/Check-out events to the backend.

Detailed Info can be found in respective SDK API docs here.

 

image

Maximum 5 entries can be set in custom event metadata. If more than 5 entries are set, Bluedot SDK throws an error as: Only 5 CustomEventMetaData fields are allowed

Created by Neha Ishwar on May 13, 2019