You can find a reference to all the types mentioned on this page here.
Request the current user context data
// returns Promise<UserContext>constuserContext=awaitSentianceUserContext.requestUserContext();/* a list of recent events, composed of stationaries, transports, and off-the-grids. The list is ordered from the most recent event to the oldest one, and includes the last detected event at the time this context was constructed, plus all preceding events up until the last stationary or off-the-grid.*/constevents=userContext.events; // the active segments detected for the user at the time this context was constructedconstactiveSegments=userContext.activeSegments;/*the user's last known location at the time this context was constructed. If the user's last detected event was an off-the-grid, or no location information was available, null is returned instead.*/constlastKnownLocation=userContext.lastKnownLocation;// the user's home location if known, otherwise returns null.consthome=userContext.home;// the user's work location if known, otherwise returns null.constwork=userContext.work;// the user's semantic time.constsemanticTime=userContext.semanticTime;
Listen to user context updates
import {addUserContextUpdateListener} from"@sentiance-react-native/user-context";constsubscription=addUserContextUpdateListener(userContext => {// User context update received});// Don't forget to unsubscribe, typically in componentWillUnmountsubscription.remove();