new Messangi()
Members
-
<readonly> Priority :number
-
Enum for Priority values.
Type:
- number
Properties:
Name Type Default Description PRIORITY_BALANCED_POWER_ACCURACYnumber 102 Request "block" level accuracy. Block level accuracy is considered to be about 100 meter accuracy. Using a coarse accuracy such as this often consumes less power.
PRIORITY_HIGH_ACCURACYnumber 100 Request the most accurate locations available. This will return the finest location available
PRIORITY_LOW_POWERnumber 104 Request "city" level accuracy. City level accuracy is considered to be about 10km accuracy. Using a coarse accuracy such as this often consumes less power.
PRIORITY_NO_POWERnumber 105 (Default) Request the best accuracy possible with zero additional power consumption. No locations will be returned unless a different client has requested location updates in which case this request will act as a passive listener to those locations.
Methods
-
init(success, error)
-
Initializes the MessangiSDK plugin
Parameters:
Name Type Description successinitCallback If initialization finishes correctly
errorerrorCallback If any error happens in the initialization process
Returns:
- Type
- void
-
validUser(success, error)
-
Verifies if user is registered
Parameters:
Name Type Description successfunction If the function is called correctly
errorerrorCallback if any error is caught calling this method
Returns:
- Type
- void
-
getUserID(success, error)
-
Get the User ID registered in Messangi
Parameters:
Name Type Description successgetUserIDCallback Method to invoke if user is successfully registered with phoneNumber as parameter
errorgetUserIDErrorCallback Method to invoke if user is not yet registered
Returns:
- Type
- void
-
onPushReceived(success, error)
-
Set the callback for the Push Received event
Parameters:
Name Type Description successonPushReceivedCallback Method to invoke if a push notification arrives
errorerrorCallback Method to invoke in case of error
Returns:
- Type
- void
-
onLocationUpdate(success, error)
-
Set the callback for Location Update event
Parameters:
Name Type Description successonLocationUpdateCallback Method to invoke when a location update event is fired
errorerrorCallback Method to invoke in case of error
Returns:
- Type
- void
-
onGeofenceTriggered(success, error)
-
Set the callback for Geofence Triggered event
Parameters:
Name Type Description successonGeofenceTriggeredCallback Method to invoke when a geofence is triggered
errorerrorCallback Method to invoke in case of error
Returns:
- Type
- void
-
getCurrentLocation(success, error)
-
Get Current Location
Parameters:
Name Type Description successgetCurrentLocationCallback Method to invoke when a location update event is fired
errorerrorCallback Method to invoke in case of error
Returns:
- Type
- void
-
register(success, error [, token])
-
Show auto registration dialog
Parameters:
Name Type Argument Description successregisterCallback Method callback if registration is successful
errorerrorCallback Method callback if an error has occurred
tokenstring <optional>
If phone number is not provided then a prompt is displayed
-
registerWithToken(success, error [, token])
-
Register the User with Token in the Messangi Backend
Parameters:
Name Type Argument Description successregisterWithTokenCallback Method callback if the registration is successful
errorerrorCallback Method callback if an error has occurred
tokenstring <optional>
If phone number is not provided then a prompt is displayed
-
registerWithPhone(success, error, phone)
-
First Step in a custom registration process, sends phone number to Messangi Server
Parameters:
Name Type Description successregisterWithPhoneCallback Method to invoke if the phone user is successfully sent to the Messangi Server
errorerrorCallback Method to invoke if an error has occurred
phonestring Phone number to register
Returns:
- Type
- void
-
activatePhoneWithCode(success, error, code)
-
Second step in custom registration process, sends the validation code arrived via SMS to Messangi to validate the user registration
Parameters:
Name Type Description successactivatePhoneWithCodeCallback Invoked if code validation is successfully sent to Messangi.
errorerrorCallback Method to invoke if an error has occurred
codestring The code number arrived via SMS
Returns:
- Type
- void
-
getAvailableWorkspaces(success, error)
-
Lists all Workspaces available to join
Parameters:
Name Type Description successgetAvailableWorkspacesCallback Method to invoke after successful execution
errorerrorCallback Method to invoke if an error has occurred
Returns:
- Type
- void
-
getSubscribedWorkspaces(success, error)
-
Lists all Workspaces to which the user is subscribed
Parameters:
Name Type Description successgetSubscribedWorkspacesCallback Method to invoke after successful execution
errorerrorCallback Method to invoke if an error has occurred
Returns:
- Type
- void
-
getDefaultWorkspace(success, error)
-
Gets the Default Workspace
Parameters:
Name Type Description successgetDefaultWorkspaceCallback Method to invoke after successful execution
errorerrorCallback Method to invoke if an error has occurred
Returns:
- Type
- void
-
getWorkspace(success, error, clientId)
-
Gets a Workspace using ClientID
Parameters:
Name Type Description successgetWorkspaceCallback Method to invoke after successful execution
errorerrorCallback Method to invoke if an error has occurred
clientIdstring The clientId of workspace to fetch
Returns:
- Type
- void
-
joinWorkspace(success, error, clientId)
-
Joins a new workspace and starts receiving notifications from it
Parameters:
Name Type Description successjoinWorkspaceCallback Method to invoke after successful execution
errorerrorCallback Method to invoke if an error has occurred
clientIdstring clientId ID of workspace to subscribe
Returns:
- Type
- void
-
leaveWorkspace(success, error, clientId)
-
Removes workspace subscription and stops receiving notifications from it
Parameters:
Name Type Description successleaveWorkspaceCallback Method to invoke after successful execution
errorerrorCallback Method to invoke if an error has occurred
clientIdstring clientId ID of the workspace to leave
Returns:
- Type
- void
-
sendMessage(success, error, message [, clientId])
-
Sends a message from device to a workspace
Parameters:
Name Type Argument Description successsendMessageCallback Method to invoke after successful execution
errorerrorCallback Method to invoke if an error has occurred
messagestring Text to send to the Workspace
clientIdstring <optional>
(Optional) Client ID of the workspace to which the message is being sent. By default uses the Main Workspace
Returns:
- Type
- void
-
listMessages(success, error [, clientsIds])
-
Gets all the messages received by the MessangiSDK, filtering them by specific workspaces
Parameters:
Name Type Argument Description successlistMessagesCallback Method to invoke after successful execution
errorerrorCallback Method to invoke if an error has occurred
clientsIdsArray.<string> <optional>
Array with all workspaces client IDs. By default uses the Main Workspace
Returns:
- Type
- void
-
listGeofences(success, error [, clientsIds])
-
Gets all the Geofences received by the MessangiSDK, filtering them by specific workspaces
Parameters:
Name Type Argument Description successlistGeofencesCallback Method to invoke after successful execution
errorerrorCallback Method to invoke if an error has occurred
clientsIdsArray.<string> <optional>
Array with all workspaces client IDs. By default uses the Main Workspace
Returns:
- Type
- void
-
listBeacons(success, error [, type] [, clientsIds])
-
Gets all the Beacons received by MessangiSDK, filtering them by specific workspaces
Parameters:
Name Type Argument Description successlistBeaconCallback Method to invoke after successful execution
errorerrorCallback Method to invoke if an error has occurred
typestring <optional>
(Optional) string with the type of Beacon to retrieve; available types: "all", "bluetooth" or "wifi"
clientsIdsArray.<string> <optional>
(Optional) Array with all workspaces client IDs. By default uses the Main Workspace
Returns:
- Type
- void
-
setLocationPriority(priority)
-
(Only for Android) - Set the priority of the location request, is a strong hint to the LocationClient for which location sources to use.
Parameters:
Name Type Description priorityPriority An accuracy or power constant
Returns:
- Type
- void
-
setLocationInterval(interval)
-
(Only for Android) - Set the desired interval for active location updates, in milliseconds. This interval is inexact. You may not receive updates at all (if no location sources are available), or you may receive them slower than requested. You may also receive them faster than requested (if other applications are requesting location at a faster interval).
Parameters:
Name Type Description intervalnumber Desired interval in millisecond, inexact
Returns:
- Type
- void
-
usePowerSaver(enable)
-
(Ony for Android) - Creating an instance power saver class can improve battery life by 60% by slowing down scans when your app is in the background.
Parameters:
Name Type Description enablebooleam true if are enable, false otherwise
Returns:
- Type
- void
-
useAndroidLScanner(enable)
-
(Ony for Android) - Allows devices with API 21+ will use the Android L APIs to scan for beacons, below 21 API use old Android Way.
Parameters:
Name Type Description enablebooleam true if are enable, false otherwise
Returns:
- Type
- void
-
useTrackingCache(enable)
-
(Ony for Android) - Allow the library to use a tracking cache
Parameters:
Name Type Description enableboolean true if are enable, false otherwise
Returns:
- Type
- void
-
setBeaconExitPeriod(millis)
-
(Ony for Android) - Elapsed time to check if Exit/Enter event will be triggered
Parameters:
Name Type Description millisnumber Set region exit period in milliseconds
-
useRegionPersistence(enable)
-
(Ony for Android) - Turns off saving the state of monitored regions to persistent storage so it is retained over app restarts. Defaults to enabled
Parameters:
Name Type Description enableboolean true if are enable, false otherwise
-
autoSetScanMode(enable)
-
(Ony for Android) - Enable or not automatically change between Background and Foreground modes. This method require app restart.
Parameters:
Name Type Description enabletrue if are enable, false otherwise
-
useBackgroundScanMode()
-
(Ony for Android) - This method notifies the beacon service that the application is either moving to background mode.
-
useForegroundScanMode()
-
(Ony for Android) - This method notifies the beacon service that the application is either moving to foreground mode.
-
setForegroundScanCycles(scanPeriod, sleepPeriod)
-
(Ony for Android) - Set the duration in milliseconds of each Foreground Cycle
Parameters:
Name Type Description scanPeriodSets the duration in milliseconds of each Bluetooth LE scan cycle to look for beacons.
sleepPeriodSets the duration in milliseconds between each Bluetooth LE scan cycle to look for beacons.
-
setBackgroundScanCycles(scanPeriod, sleepPeriod)
-
(Ony for Android) - Set the duration in milliseconds of each Background Cycle
Parameters:
Name Type Description scanPeriodSets the duration in milliseconds of each Bluetooth LE scan cycle to look for beacons.
sleepPeriodSets the duration in milliseconds between each Bluetooth LE scan cycle to look for beacons.