onymos-logo

onymosGeo.getLocation

To obtain details about the user’s current location.

OnymosGeo.getLocation(
(locationObj) => {
/* ------
locationObj = {
latitude: The latitude coordinate of a location. Between -90.0 to 90.0 degrees,
longitude: The longitude coordinate of a location. Between -180.0 to 180.0 degrees,
altitude: The altitude of a location, if available, in meters,
course: The direction of the device's movement, if available, in degrees relative to north,
speed: The speed, if available, in meters per second,
horizontalAccuracy: The estimated horizontal accuracy of the location, if available, in meters,
verticalAccuracy: The estimated vertical accuracy of the location, if available, in meters,
timestamp: The time location was retrieved, in Unix epoch time
};
------ */
},
(error) => {
console.log(error);
}
);

onymosGeo.startLocationUpdates

To continuously track the user’s current location. May also provide parameters that affect the frequency or accuracy of location updates, which will also affect battery usage.

OnymosGeo.startLocationUpdates(
(locationObj) => {
console.log(locationObj);
},
(error) => {
console.log(error);
},
options
);
options
minDistBeforeUpdate

Number

The minimum horizontal distance that must be traveled before an update, in meters.

minTimeBeforeUpdate

Number

The minimum time before a location update, in seconds. Only for use with Android devices.

desiredAccuracy

Constant

The desired accuracy of the location updates. Only for use with iOS devices.

Android Usage Example

{
minDistBeforeUpdate: 20,
minTimeBeforeUpdate: 15
}

iOS Usage Example

{
minDistBeforeUpdate: 20,
desiredAccuracy: OnymosGeoConstants.Accuracy.best
}

onymosGeo.stopLocationUpdates

To stop tracking user and end updates about the user’s current location.

OnymosGeo.stopLocationUpdates(
(status) => {
console.log(status);
},
(error) => {
console.log(error);
}
);

onymosGeo.getLocationDetails

To obtain details about a location by using its latitude and longitude coordinates.

OnymosGeo.getLocationDetails(
latitude,
longitude,
(locInfoObj) => {
/* ------
locInfoObject = {
countryName: The name of the country of the location, if known,
countryCode: The country code of the location, for example, "US", if known,
adminArea: The administrative area of the location, for example, "CA", if known,
subAdminArea: The sub-administrative area, if known,
locality: The locality (city) of the location, if known,
subLocality: The sub-locality (additional city-level info) of the location, if known,
thoroughfare: The street address of the location, for example, "Main Street", if known,
subThoroughfare: The sub-thoroughfare (additional streel-level info) of the location, if known,
postalCode: The postal code of the address, if known,
timeZone: The timezone of the location, if known. iOS only
};
------ */
},
(error) => {
console.log(error);
}
);
latitude

Number

The latitude coordinate of a location. Falls within the range of -90.0 to 90.0 degrees.

longitude

Number

The longitude coordinate of a location. Falls within the range of -180.0 to 180.0 degrees.

onymosGeo.getLocationFromAddress

To obtain the latitude and longitude coordinates from a given address.

OnymosGeo.getLocationFromAddress(
address,
(coordsObj) => {
/* ------
coordsObject = {
latitude: The latitude coordinate of a location. Between -90.0 to 90.0 degrees,
longitude: The longitude coordinate of a location. Between -180.0 to 180.0 degrees
};
------ */
},
(error) => {
console.log(error);
}
);
address

String

An address or name of a location. Can be general (e.g., “Dalvik, Iceland”) or specific (e.g., 565 University Ave, Los Gatos, CA 95032).

onymosGeo.setLocationPowerSetting

To set or reset parameters that describe the accuracy and frequency of location updates. This will affect battery usage. If fields are not provided, default values will be used.

OnymosGeo.setLocationPowerSetting(
(status) => {
console.log(status);
},
(error) => {
console.log(error);
},
options
);
options
minDistBeforeUpdate

Number

The minimum horizontal distance that must be traveled before an update, in meters.

minTimeBeforeUpdate

Number

The minimum time before a location update, in seconds. Only for use with Android devices.

desiredAccuracy

Constant

The desired accuracy of the location updates. Only for use with iOS devices.

Android Usage Example

{
minDistBeforeUpdate: 20,
minTimeBeforeUpdate: 15
}

iOS Usage Example

{
minDistBeforeUpdate: 20,
desiredAccuracy: OnymosGeoConstants.Accuracy.best
}

onymosGeo.createGeoFence

To set or reset parameters that describe the accuracy and frequency of location updates. This will affect battery usage. If fields are not provided, default values will be used.

OnymosGeo.createGeoFence(
latitude,
longitude,
radius,
setActive,
(geoFenceObject) => {
/* ------
geoFenceObject = {
id: The unique string id of the geofence,
latitude: The latitude coordinate of a location. Falls within the range of -90.0 to 90.0 degrees,
longitude: The longitude coordinate of a location. Falls within the range of -180.0 to 180.0 degrees,
radius: The radius of the geofence, in meters,
monitoring: Boolean indicating whether the GeoFence is currently being monitored,
localNotifTitle: The geofence's notification title, if provided,
localNotifMessage: The geofence's notification message, if provided,
notifOnEntry: Boolean indication if a notification should be sent on entry of this geofence, if specified,
notifOnExit: Boolean indication if a notification should be sent on exit of this geofence, if specified,
notifOnDwell: Boolean indication if a notification should be sent after dwelling in this geofence, if specified,
loiteringDelay: The time spent in a geofence before a notification triggers for a dwell notification, if specified,
activeDuration: The duration of time a GeoFence is active in milliseconds, if provided.
};
------ */
},
(error) => {
console.log(error);
},
options
);
Note:
Up to 100 GeoFences can be stored. Due to device limitations, Android devices can actively monitor up to 100 GeoFences at once, while iOS devices can monitor 20. If the new GeoFence is specified to be active, an error will be given if the device has already reached its monitoring capacity.

If active, GeoFence must have at least one of the following transitions specified in options: notifOnEntry, notifOnExit, or notifOnDwell. (If using iOS devices, notifOnDwell is not supported.) These specify when a notification will trigger for a GeoFence. At least one of the transitions must be used, or else an error will be given. If the GeoFence is specified as not active, no transition should be given.
latitude

Number

The latitude coordinate of a location. Falls within the range of -90.0 to 90.0 degrees.

longitude

Number

The longitude coordinate of a location. Falls within the range of -180.0 to 180.0 degrees.

radius

Number

The radius of the GeoFence, in meters.

setActive

Boolean

Specifies whether the GeoFence should be monitored upon creation or not.

options
localNotifTitle

String

The text for the title of a the notification associated with this GeoFence.

localNotifMessage

String

The text for the message of a the notification associated with this GeoFence.

notifOnEntry

Boolean

Specifies whether a notification should be sent upon entering the GeoFence.

notifOnExit

Boolean

Specifies whether a notification should be sent upon exiting the GeoFence.

notifOnDwell

Boolean

Specifies whether a notification should be sent after dwelling in the GeoFence for some amount of time. Only for use with Android devices.

Note:
When notifOnDwell is true, a loiteringDelay must be provided as well.

loiteringDelay

Number

The time that must pass after entering a GeoFence boundary before a notification should be delivered. Only for use with Android devices.

Note:
This is only used when a dwell transition is specified. When notifOnDwell is true, a loiteringDelay must be provided as well.

activeDuration

Number

The time that the GeoFence is active in milliseconds. After the duration ends, the GeoFence will automatically be unmonitored and removed. If not specified, the GeoFence will not expire automatically, and must be unmonitored or removed manually. Only available for Android devices.

Standard Usage Example

{
localNotifTitle: “GeoFence Notification”,
localNotifMessage: “Hello”,
notifOnEntry: true
}

Dwelling Usage Example

{
localNotifTitle: “GeoFence Notification”,
localNotifMessage: “Hello”,
notifOnEntry: true
notifOnDwell: true
loiteringDelay: 3000,
activeDuration: 3600000
}

onymosGeo.setGeoFenceActive

To set a particular GeoFence to monitored if it exists and is currently unmonitored.

OnymosGeo.setGeoFenceActive(
id,
(status) => {
console.log(status);
},
(error) => {
console.log(error);
},
options
);
Note:
Due to device limitations, Android devices can actively monitor up to 100 GeoFences at once, while iOS devices can monitor 20. An error will be given if the device has already reached its monitoring capacity.
To set to active, one of the following transitions specified in options: notifOnEntry, notifOnExit, or notifOnDwell. (If using iOS devices, notifOnDwell is not supported.) These specify when a notification will trigger for a GeoFence. At least one of the transitions must be used, or else an error will be given.
id

String

The unique id of the GeoFence.

options
notifOnEntry

Boolean

Specifies whether a notification should be sent upon entering the GeoFence.

notifOnExit

Boolean

Specifies whether a notification should be sent after dwelling in the GeoFence for some amount of time. Only for use with Android devices.

Note:
When notifOnDwell is true, a loiteringDelay must be provided as well.

notifOnDwell

Boolean

Specifies whether a notification should be sent after dwelling in the GeoFence for some amount of time. Only for use with Android devices.

Note:
When notifOnDwell is true, a loiteringDelay must be provided as well.

loiteringDelay

Number

The time that must pass after entering a GeoFence boundary before a notification should be delivered. Only for use with Android devices.

Note:
This is only used when a dwell transition is specified. When notifOnDwell is true, a loiteringDelay must be provided as well.

activeDuration

Number

The time that the GeoFence is active in milliseconds. After the duration ends, the GeoFence will automatically be unmonitored and removed. If not specified, the GeoFence will not expire automatically, and must be unmonitored or removed manually. Only available for Android devices.

Standard Usage Example

{
notifOnEntry: true
}

Dwelling Usage Example

{
notifOnEntry: true,
notifOnDwell: true,
loiteringDelay: 3000,
activeDuration: 3600000
}

onymosGeo.setGeoFenceInactive

To set a particular GeoFence to unmonitored if it exists and is currently monitored.

OnymosGeo.setGeoFenceInactive(
id,
(status) => {
console.log(status);
},
(error) => {
console.log(error);
}
);
id

String

The unique id of the GeoFence.

onymosGeo.getMonitoredGeoFences

To retrieve the array of currently monitored GeoFences.

const geoFenceArray = OnymosGeo.getMonitoredGeoFences();
/* ------
geoFenceArray = [{
id: The unique string id of the geofence,
latitude: The latitude coordinate of a location. Falls within the range of -90.0 to 90.0 degrees,
longitude: The longitude coordinate of a location. Falls within the range of -180.0 to 180.0 degrees,
radius: The radius of the geofence, in meters,
monitoring: Boolean indicating whether the GeoFence is currently being monitored,
localNotifTitle: The geofence's notification title, if provided,
localNotifMessage: The geofence's notification message, if provided,
notifOnEntry: Boolean indication if a notification should be sent on entry of this geofence, if specified,
notifOnExit: Boolean indication if a notification should be sent on exit of this geofence, if specified,
notifOnDwell: Boolean indication if a notification should be sent after dwelling in this geofence, if specified,
loiteringDelay: The time spent in a geofence before a notification triggers for a dwell notification, if specified,
activeDuration: The duration of time a GeoFence is active in milliseconds, if provided.
}];
------ */
Note:
This is a synchronous call.

onymosGeo.getUnmonitoredGeoFences

To retrieve the array of currently unmonitored GeoFences.

const geoFenceArray = OnymosGeo.getUnmonitoredGeoFences();
/* ------
geoFenceArray = [{
id: The unique string id of the geofence,
latitude: The latitude coordinate of a location. Falls within the range of -90.0 to 90.0 degrees,
longitude: The longitude coordinate of a location. Falls within the range of -180.0 to 180.0 degrees,
radius: The radius of the geofence, in meters,
monitoring: Boolean indicating whether the GeoFence is currently being monitored,
localNotifTitle: The geofence's notification title, if provided,
localNotifMessage: The geofence's notification message, if provided,
notifOnEntry: Boolean indication if a notification should be sent on entry of this geofence, if specified,
notifOnExit: Boolean indication if a notification should be sent on exit of this geofence, if specified,
notifOnDwell: Boolean indication if a notification should be sent after dwelling in this geofence, if specified,
loiteringDelay: The time spent in a geofence before a notification triggers for a dwell notification, if specified,
activeDuration: The duration of time a GeoFence is active in milliseconds, if provided.
}];
------ */
Note:
This is a synchronous call.

onymosGeo.deleteGeoFence

To delete a particular GeoFence. If the GeoFence is being monitored, it will be unmonitored first.

OnymosGeo.deleteGeoFence(
id,
(status) => {
console.log(status);
},
(error) => {
console.log(error);
}
);
id

String

The unique id of the GeoFence.

onymosGeo.deleteAllGeoFences

To delete all GeoFences. Unmonitors GeoFences if they are monitored, then deletes them. Deletes based on the monitoringStatus if given, else deletes all GeoFences.

OnymosGeo.deleteAllGeoFences(
(status) => {
console.log(status);
},
(error) => {
console.log(error);
},
options
);
options
monitoringStatus

String

One of “monitored”, “unmonitored”, or “both”. The active status of the GeoFences to be deleted. Providing “monitored” will delete all currently monitored GeoFences, “unmonitored” will delete unmonitored GeoFences, and “both” will delete all GeoFences.

Usage Example

{
monitoringStatus: “monitored”
}

onymosGeo.isLocationInGeoFence

To check if a location lies within any of the active GeoFence boundaries. Uses a specific location if provided, otherwise this function will use the user’s location. Finds all of the GeoFences that the location lies within, if any.

OnymosGeo.isLocationInGeoFence(
(geoFenceArray) => {
/* ------
geoFenceArray = [{
id: The unique string id of the geofence,
latitude: The latitude coordinate of a location. Falls within the range of -90.0 to 90.0 degrees,
longitude: The longitude coordinate of a location. Falls within the range of -180.0 to 180.0 degrees,
radius: The radius of the geofence, in meters,
monitoring: Boolean indicating whether the GeoFence is currently being monitored,
localNotifTitle: The geofence's notification title, if provided,
localNotifMessage: The geofence's notification message, if provided,
notifOnEntry: Boolean indication if a notification should be sent on entry of this geofence, if specified,
notifOnExit: Boolean indication if a notification should be sent on exit of this geofence, if specified,
notifOnDwell: Boolean indication if a notification should be sent after dwelling in this geofence, if specified,
loiteringDelay: The time spent in a geofence before a notification triggers for a dwell notification, if specified,
activeDuration: The duration of time a GeoFence is active in milliseconds, if provided.
}];
------ */
},
(error) => {
console.log(error);
},
options
);
options
latitude

Number

The latitude coordinate of a location. Falls within the range of -90.0 to 90.0 degrees.

longitude

Number

The longitude coordinate of a location. Falls within the range of -180.0 to 180.0 degrees.

Usage Example

{
latitude: 42.09,
longitude: -121.1
}

onymosGeo.closestGeoFence

To find the closest active GeoFence to a location using the GeoFence’s center. Uses a specific location if coordinates are provided, otherwise this function will use the user’s location.

OnymosGeo.closestGeoFence(
(geoFenceObject) => {
/* ------
geoFenceObject = {
id: The unique string id of the geofence,
latitude: The latitude coordinate of a location. Falls within the range of -90.0 to 90.0 degrees,
longitude: The longitude coordinate of a location. Falls within the range of -180.0 to 180.0 degrees,
radius: The radius of the geofence, in meters,
monitoring: Boolean indicating whether the GeoFence is currently being monitored,
localNotifTitle: The geofence's notification title, if provided,
localNotifMessage: The geofence's notification message, if provided,
notifOnEntry: Boolean indication if a notification should be sent on entry of this geofence, if specified,
notifOnExit: Boolean indication if a notification should be sent on exit of this geofence, if specified,
notifOnDwell: Boolean indication if a notification should be sent after dwelling in this geofence, if specified,
loiteringDelay: The time spent in a geofence before a notification triggers for a dwell notification, if specified,
activeDuration: The duration of time a GeoFence is active in milliseconds, if provided.
};
------ */
},
(error) => {
console.log(error);
},
options
);
options
latitude

Number

The latitude coordinate of a location. Falls within the range of -90.0 to 90.0 degrees.

longitude

Number

The longitude coordinate of a location. Falls within the range of -180.0 to 180.0 degrees.

Usage Example

{
latitude: 42.09,
longitude: -121.1
}

onymosGeo.getDistFromGeoFence

To obtain the distance between a location and the specified GeoFence’s center, in meters. Uses a specific location if coordinates are provided, otherwise this function will use the user’s location.

OnymosGeo.getDistFromGeoFence(
id,
(distance) => {
console.log(distance);
},
(error) => {
console.log(error);
},
options
);
id

String

The unique id of the GeoFence.

options
latitude

Number

The latitude coordinate of a location. Falls within the range of -90.0 to 90.0 degrees.

longitude

Number

The longitude coordinate of a location. Falls within the range of -180.0 to 180.0 degrees.

desiredAccuracy

Usage Example

{
latitude: 42.09,
longitude: -121.1
}

Use Onymos for: AI doc processing / IoT connectivity / rapid app dev

Reach out, get started.

Overlay