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.
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);
}
);
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
);
Number
The minimum horizontal distance that must be traveled before an update, in meters.
Number
The minimum time before a location update, in seconds. Only for use with Android devices.
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
}
To stop tracking user and end updates about the user’s current location.
OnymosGeo.stopLocationUpdates(
(status) => {
console.log(status);
},
(error) => {
console.log(error);
}
);
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);
}
);
Number
The latitude coordinate of a location. Falls within the range of -90.0 to 90.0 degrees.
Number
The longitude coordinate of a location. Falls within the range of -180.0 to 180.0 degrees.
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);
}
);
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).
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
);
Number
The minimum horizontal distance that must be traveled before an update, in meters.
Number
The minimum time before a location update, in seconds. Only for use with Android devices.
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
}
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
);
Number
The latitude coordinate of a location. Falls within the range of -90.0 to 90.0 degrees.
Number
The longitude coordinate of a location. Falls within the range of -180.0 to 180.0 degrees.
Number
The radius of the GeoFence, in meters.
Boolean
Specifies whether the GeoFence should be monitored upon creation or not.
String
The text for the title of a the notification associated with this GeoFence.
String
The text for the message of a the notification associated with this GeoFence.
Boolean
Specifies whether a notification should be sent upon entering the GeoFence.
Boolean
Specifies whether a notification should be sent upon exiting the GeoFence.
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.
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.
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
}
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
);
String
The unique id of the GeoFence.
Boolean
Specifies whether a notification should be sent upon entering the GeoFence.
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.
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.
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.
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
}
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);
}
);
String
The unique id of the GeoFence.
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.
}];
------ */
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.
}];
------ */
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);
}
);
String
The unique id of the GeoFence.
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
);
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”
}
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
);
Number
The latitude coordinate of a location. Falls within the range of -90.0 to 90.0 degrees.
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
}
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
);
Number
The latitude coordinate of a location. Falls within the range of -90.0 to 90.0 degrees.
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
}
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
);
String
The unique id of the GeoFence.
Number
The latitude coordinate of a location. Falls within the range of -90.0 to 90.0 degrees.
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
}