JS SDK
JS SDK
Table of contents
Table of contents 1
Introduction 2
Quick Guides 2
Step 1: Include SDK and Initialize GLV Client 2
Step 2: Verify Location ( geolocate/setupAndGeolocate ) 3
1. geolocateOptions 3
2. middleCallback 4
3. finalCallback 7
Example 8
UI Suggestion 9
That’s It! 10
Quick Guides
For the clients who are integrated with JS SDK 3.3 or lower, stop using the request()
method and follow the steps below to integrate with JS SDK 4.0
● If you use the method: client.request(); from the previous version of JS SDK,
remove or comment on it.
// client.request();
● Remove all related hint event listeners. They are redundant now.
// client.on(‘all_events’, callback);
define(['gc-oobee'], function(GCOobee) {
// Initialize new GLV Client
var client = GCOobee.createClient();
● If users have not installed the GLV app yet, you should use the setupAndGeolocate
method. It will navigate to the store, and after installing the app successfully and going
back to browser, the verify location process will automatically start.
● Otherwise, If users already have installed the GLV app then just use the geolocate
method to perform the location verification.
1. geolocateOptions
Put all necessary input data inside geolocateOptions Object on every geolocation
request
var geolocateOptions = {
license: 'license_string',
userId: 'user_id_123',
};
2. middleCallback
The middle callback should act like the middleware action needed to complete the
process, like requiring users to open/install GLV App or grant some permissions…
Sometimes it will return the log message to inform the process’s status.
// Example of handleInteraction
// Using Sweet alert lib to generate Popup
The handleInteraction method should show the POPUP to ask the help from users by
tapping on the button to continue the process.
● If you want to provide an escape way to users can cancel the process, try this one:
● app_required
○ when need to open the app to geolocate.
● tlb_require
○ when need to open TLB (TrueLocation Browser) to geolocate.
● location_required
○ when Location permission is not granted.
● precise_location_required
○ when Precise Location permission is not granted.
● notification_required
○ when Notification on iOS permission is not granted. (Android no need
notification permission anymore)
● app_update_required
○ when app is out of date, need to update.
3. finalCallback
The final callback will receive the result or error of geolocate request.
var geolocateOptions = {
oobeeUrl: 'oobee_url,
license: 'license_string',
userId: 'user1',
reason: 'login',
…optionalParameters
}
● If you want to verify location right after login success try this
That’s It!
Please check the GeoGuard Location Validator JS SDK, Interface Definition v4.0, for more
detailed information. Thank you.