Skip to content

User Events

Info

This document is a work in progress.

Currently, User events contain below events, still working in progress:

  • User Events
    • Set Home Event - Should be sent by HMI when user adds/removes home address, user can add/remove by setting ActionType as ADD/DELETE.
    • Set Work Event - Should be sent by HMI when user adds/removes work address, user can add/remove by setting ActionType as ADD/DELETE.

User Events

Set Home Event

Set home event should be sent by HMI when user adds/removes home address, user can add/remove by setting ActionType as ADD/DELETE.

Key methods

Method Details
setEntityId(String entity_id) The EntityId address/POI, mandatory data field.
setLat(Double lat) Set to raw latitude, mandatory data field.
setLon(Double lon) Set to raw longitude, mandatory data field.
setActionType(ActionType action) ActionType as ADD/DELETE when user add/remove home address, mandatory data field.
setLabel(String label) For the name alias for this home, optional data field.
enum index ActionType
0 ADD
1 DELETE


Sample code

1
2
3
4
5
SendEventRequest.Builder builder = dataCollectorClient.sendEventRequest();
SendEventResponse response = builder
        .setEvent(SetHomeEvent.builder().setLabel("Label").setEntityId("EntityId")
        .setActionType(SetHomeEvent.ActionType.SET).setLat(31.201840).setLon(121.541237)
        .build()).build().execute();
1
2
3
4
5
var builder = dataCollectorClient.sendEventRequest();
var response = builder
        .setEvent(SetHomeEvent.builder().setLabel("Label").setEntityId("EntityId")
        .setActionType(SetHomeEvent.ActionType.SET).setLat(31.201840).setLon(121.541237)
        .build()).build().execute()

Response example

1
2
3
4
5
{
  "code": "SUCCESS",
  "message": "SendEventResponse Success",
  "response_time": 1
}

Set Work Event

Set work event should be sent by HMI when user adds/removes work address, user can add/remove by setting ActionType as ADD/DELETE.

Key methods

Method Details
setEntityId(String entity_id) The EntityId address/POI, mandatory data field.
setLat(Double lat) Set to raw latitude, mandatory data field.
setLon(Double lon) Set to raw longitude, mandatory data field.
setActionType(ActionType action) ActionType as ADD/DELETE when user add/remove work address, mandatory data field.
setLabel(String label) For the name alias for this work, optional data field.
enum index ActionType
0 ADD
1 DELETE


Search API sample code synchronously using execute() method

1
2
3
4
5
SendEventRequest.Builder builder = dataCollectorClient.sendEventRequest();
SendEventResponse response = builder
    .setEvent(SetWorkEvent.builder().setLabel("Label").setEntityId("EntityId")
    .setActionType(SetWorkEvent.ActionType.SET).setLat(31.201840).setLon(121.541237)
    .build()).build().execute();
1
2
3
4
5
var builder = dataCollectorClient.sendEventRequest()
var response = builder
    .setEvent(SetWorkEvent.builder().setLabel("Label").setEntityId("EntityId")
    .setActionType(SetWorkEvent.ActionType.SET).setLat(31.201840).setLon(121.541237)
    .build()).build().execute()

You can also call API asynchronously using asyncCall() method of builder if no need to cancel the request.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
SendEventRequest.Builder builder = client.sendEventRequest();

builder.setEvent(SetWorkEvent.builder()
    .setLabel("Label").setEntityId("faked_id")
    .setActionType(SetWorkEvent.ActionType.SET).setLat(31.201840).setLon(121.541237).build())
    .asyncCall(new Callback<SendEventResponse>() {

        @Override
        public void onSuccess(SendEventResponse response) {
            System.out.println("\n[Async SendEvent Response]: \n" + DataCollectorJsonConverter.toJson(response));
        }

        @Override
        public void onFailure(Throwable t) {
            if(t!= null) {
                t.printStackTrace();
            }
        }
    });
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
var builder = client.sendEventRequest()

builder.setEvent(SetWorkEvent.builder()
    .setLabel("Label").setEntityId("faked_id")
    .setActionType(SetWorkEvent.ActionType.SET).setLat(31.201840).setLon(121.541237).build())
    .asyncCall(new Callback<SendEventResponse>() {

        @Override
        public void onSuccess(SendEventResponse response) {
            System.out.println("\n[Async SendEvent Response]: \n" + DataCollectorJsonConverter.toJson(response))
        }

        @Override
        public void onFailure(Throwable t) {
            if(t!= null) {
                t.printStackTrace()
            }
        }
    });

Response example

1
2
3
4
5
{
  "code": "SUCCESS",
  "message": "SendEventResponse Success",
  "response_time": 1
}