Frontend APIs (GoPay Container V4) (Internal Only)

This guide explains the technical specifications of JSAPIs that is available to be called from your application's frontend.

Integrate SDK

  1. Include the gpContainer SDK in Your Codebase
    To use the SDK, add the following

    <script src="https://gwk.gopayapi.com/sdk/stable/gp-container.min.js"></script>
    
  2. Invoking SDK Methods
    To call any JSAPI from the SDK, use the following format:

    window.gpContainer.call(className, methodName, params, successCallback, failureCallback, timeout);
    


Supported JSAPIs

GPMiniAppAuth

APIFunctionRequires Consent
GPMiniAppAuth.getAuthCodeGet an auth code used to identify the current user sessionNo

GP

APIFunctionRequires Consent
GP.launchPaymentAutomatically redirect users to the GoPay app to complete the payment, then return them to your Mini App.No

GPNavigator

APIFunctionAndroidIOS
GPNavigator.launchDeeplinkOpen a third-party app or page using a custom deeplinkSupportSupport
GPNavigator.launchUriOpen a browser or in-app page using a universal or web URISupportSupport
GPNavigator.popCloses the current page.SupportSupport
GPNavigator.pushOpens a new page in the miniapp.SupportSupport

GPMotion

APIFunctionAndroidIOS
GPMotion.listenBlowMonitors blow gestures.SupportSupport
GPMotion.stopListenBlowStops monitoring blow gestures.SupportSupport
GPMotion.listenGyroEnables or disables monitoring of the gyroscope.SupportSupport
GPMotion.listeningShakeEnables or disables monitoring of shake gestures.SupportSupport
GPMotion.vibrateMakes the phone vibrate.SupportSupport
GPMotion.startAccelerometerMonitors acceleration data.SupportSupport
GPMotion.stopAccelerometerStops monitoring acceleration data.SupportSupport
GPMotion.startCompassMonitors compass data.SupportSupport
GPMotion.stopCompassStops monitoring compass data.SupportSupport

Base

APIFunctionAndroidIOS
GPBase.copyToClipboardCopies the specified text to the clipboard.SupportSupport
GPBase.isInstallChecks whether the specified app is installed.SupportSupport
GPBase.isAppsInstalledChecks whether the specified apps are installed.SupportSupport
GPBase.notifyTriggers the specified event in document.Not SupportSupport
GPBase.setBackgroundColorConfigures the background color of WebView.Not SupportSupport
GPBase.canIUseChecks whether an API is supported by the current WindVane SDK version.SupportSupport
GPMiniApp.closeCloses the miniapp.SupportSupport

Widget

APIFunctionAndroidIOS
GPUI.showLoadingBoxDisplays the loading message.SupportSupport
GPUI.hideLoadingBoxHides the loading message.SupportSupport
GPUI.hideKeyboardHides the keyboard.SupportSupport

Prompt

APIFunctionAndroidIOS
GPUIToast.toastDisplays a toast in the center of the screen.SupportSupport

Dialog

APIFunctionAndroidIOS
GPUIDialog.alertDisplays a warning message.SupportSupport
GPUIDialog.confirmDisplays a confirmation message.SupportSupport
GPUI.enableAlertBeforeUnloadDisplays a confirmation message when a user attempts to close the miniapp by clicking the Back button.SupportSupport
GPUI.disableAlertBeforeUnloadDoes not display a confirmation message when a user attempts to close the miniapp by clicking the Back button.SupportSupport
GPUIDialog.promptDisplays a text box where a user can input text.SupportSupport
GPUIDialog.showAuthGuideDisplays a dialog box to guide the user in granting permissions. The dialog box provides text and illustrations.SupportSupport

Action List

APIFunctionAndroidIOS
GPUIActionSheet.showDisplays an action sheet. A list of buttons is displayed at the bottom of the screen.SupportSupport

Navigation Bar

APIFunctionAndroidIOS
GPNavigationBar.updateConfigures the navigation bar of the current page.SupportSupport
GPNavigationBar.getHeightObtains the height of the navigation bar in the miniapp.SupportSupport

Multimedia

APIFunctionAndroidIOS
GPImage.saveImageSaves images from HTTP or HTTPS URLs or Base64-encoded images to albums.SupportSupport
GPVideo.chooseVideoShoots a video or selects a video from an album.SupportSupport
GPVideo.saveVideoToPhotosAlbumSaves an online video to a local album.SupportSupport
GPAudio.playSystemSoundPlays the specified system sound.Not SupportSupport
GPCamera.takePhotoTakes a photo or selects a photo from the album. Users can determine whether to enable automatic photo upload. The automatic photo upload feature needs to be implemented in the native application.SupportSupport
GPCamera.confirmUploadPhotoConfirms the photo upload.SupportSupport

Cache

APIFunctionAndroidIOS
GPStorage.setItemSets the value of a specified key in the local cache.SupportSupport
GPStorage.getItemObtains the value of a specified key from the local cache.SupportSupport
GPStorage.removeItemRemoves the value of a specified key from the local cache.SupportSupport
GPStorage.clearStorageAsynchronously clears the local data cache.SupportSupport
GPStorage.clearStorageSyncSynchronously clears the local data cache.SupportSupport

File

APIFunctionAndroidIOS
GPFile.writeWrites the specified content to a disk.SupportSupport
GPFile.readReads the content of a specified file.SupportSupport
GPFile.getFileInfoObtains information about a file.SupportSupport
GPFile.downloadFileDownloads a file from a specified URL.SupportSupport
GPFile.uploadFileUploads a file to a specified server URL.SupportSupport

Geographic location

APIFunctionAndroidIOS
GPLocation.getLocationObtains the current geographic location. (Requires Consent)SupportSupport
GPLocation.searchLocationSearches for the specified address and obtains the latitude and longitude.Not SupportSupport

Cookie

APIFunctionAndroidIOS
GPCookie.readReads all cookies from a specified URL.SupportSupport
GPCookie.writeWrites a cookie.SupportSupport

System information

APIFunctionAndroidIOS
GPSystem.getSystemInfoObtains the system information of a device.SupportSupport
GPSystem.getSystemInfoSyncSynchronously obtains the system information of a device.SupportSupport

Device environment detection

APIFunctionAndroidIOS
GPNativeDetector.isSimulatorChecks whether the device is simulated.SupportSupport
GPNativeDetector.getCurrentUsageObtains the current CPU utilization and memory usage.SupportSupport
GPNativeDetector.getDeviceYearObtains the release year of the device. You can learn about the device performance based on its release year. You can easily identify the model of an iOS device and determine whether its performance can meet your business requirements. For an Android device, you can determine whether its performance is adequate only based on its release year.SupportSupport
GPNativeDetector.getModelInfObtains the device information, such as the device model.SupportSupport
GPNativeDetector.getSafeAreaInsetsObtains the safe area information of the current view. This API is available only for full screen pages.Not SupportSupport

Network status

APIFunctionAndroidIOS
GPNetwork.getNetworkTypeObtains the current network type.SupportSupport

Screen

APIFunctionAndroidIOS
GPScreen.getOrientationObtains the display orientation (landscape or portrait) of the current activity or view controller.SupportSupport
GPScreen.setOrientationSets the display orientation (landscape or portrait) of the current activity or view controller.SupportSupport
GPScreen.setScreenBrightnessSets the screen brightness.SupportSupport
GPScreen.getScreenBrightnessObtains the screen brightness.SupportSupport

Screenshot

APIFunctionAndroidIOS
GPScreenCapture.captureTakes a screenshot of the visible content in WebView.SupportSupport

Beep

APIFunctionAndroidIOS
GPNotification.beepMakes the phone beep.SupportSupport

Calling

APIFunctionAndroidIOS
GPCall.dialDisplays the telephone keypad.SupportSupport
GPCall.callMakes a phone call directly.SupportSupport

Application information

APIFunctionAndroidIOS
GPApplication.appStateReturns the status of the application. The status indicates whether the application is running in the foreground.Not SupportSupport
GPApplication.getNotificationSettingsReturns the notification settings of the application.Not SupportSupport
GPApplication.openSettingsDisplays the settings page of the application.Not SupportSupport

Address book

APIFunctionAndroidIOS
GPContacts.askAuthRequests access to contacts.Not SupportSupport
GPContacts.authStatusChecks whether access permissions on contacts are granted.Not SupportSupport
GPContacts.chooseDisplays contacts. After a user selects a contact, the name and phone number of the contact are returned to the HTML5 page.SupportSupport
GPContacts.findSearches for a contact by specifying the name and phone number.SupportSupport
GPContacts.addPhoneContactsAdds a contact.SupportSupport

Code scanning

APIFunctionAndroidIOS
GPScan.scanEnables the scanning feature.SupportSupport

Device battery

APIFunctionAndroidIOS
GPBattery.getBatteryInfoAsynchronously obtains the battery level.SupportSupport
GPBattery.getBatteryInfoSyncDevice batterySupportSupport

Bluetooth

APIFunctionAndroidIOS
GPBluetooth.requestAuthorizationRequests Bluetooth permissions and enables Bluetooth.SupportSupport
GPBluetooth.scanSearches for Bluetooth Low Energy (BLE) devices.SupportSupport
GPBluetooth.stopScanStops searching for BLE devices.SupportSupport
GPBluetooth.connectConnects the device on which the application runs to a Bluetooth device with a specified Bluetooth address.SupportSupport
GPBluetooth.disconnectDisconnects the connected Bluetooth devices.SupportSupport
GPBluetooth.getServicesStarts to search for the BLE device services.SupportSupport
GPBluetooth.getCharacteristicsObtains values of all characteristics of BLE devices.SupportSupport
GPBluetooth.writeValueSets the value of a specified characteristic to a connected BLE device.SupportSupport
GPBluetooth.readValueReads the value of a specified characteristic from a connected BLE device.SupportSupport
GPBluetooth.startNotificationsEnables the notification of characteristic value changes.SupportSupport
GPBluetooth.stopNotificationsDisables the notification of characteristic value changes.SupportSupport

Communication

APIFunctionAndroidIOS
GPStandardEventCenter.postNotificationToNativeSends events from the miniapp to a native application. The event name can be modified based on the business requirements of the native application.SupportSupport

Other features

APIFunctionAndroidIOS
BackgroundWhen the application starts to run in the background, for example, when a user switches to another app or opens the notification bar, GoPay Container SDK triggers the GP.Event.APP.Background event. The page can listen for this event to determine whether the application switches to the background.SupportSupport
ActiveWhen the application switches from the background to the foreground, WindVane triggers the GP.Event.APP.Active event. The page can listen for this event to determine whether the application is active.SupportSupport
Pull RefreshIn iOS, the pull-to-refresh feature is enabled by default. The pull-to-refresh feature is enabled by default. You must disable the feature manually.Not SupportSupport
Infinite ScrollEnables the infinite scrolling feature. More content is loaded when a user scrolls to the bottom of the page. Infinite scrolling is disabled by default. You must enable the feature manually.Not SupportSupport

JSAPIs Specification (v1.0.0)

📝

Note

  • Data will be null in case of success = false, and vice versa.
  • Error will be null in case of success = true, and vice versa.

Get Location

Sample Request:

var params = {
	// Specify whether to obtain a high-precision location.
	enable_high_accuracy: true
};

window.gpContainer.call(  
  "GPLocation",  
  "getLocation",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
    "data": {
      "coords": {
        "longitude": 77.5946,
        "latitude": 12.9716,
        "time": 12
      }
    },
    "ret": "GP_SUCCESS" 
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

Get Auth Code

Sample Request:

window.gpContainer.call(  
  "GPMiniAppAuth",  
  "getAuthCode",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
    "data": {
        authCode: "GBNURP5WyBIqXiGxKv2cO8Qj4CyS0qZrRK5O4e8ehdnHpowG6k5pkj2SsF7BqGIF"
    },
		"ret": "GP_SUCCESS" 
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

Launch Deeplink

Sample Request:

var params = {
  deeplink: "gopay://..."
};

window.gpContainer.call(  
  "GPNavigator",  
  "launchDeeplink",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
		success: true,
		"ret": "GP_SUCCESS" 
}
{
    "success": false,
    "errorCode": "300",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "Permission denied",
    "ret": "GP_EXCEPTION"   
}

Launch Payment

Sample Request:

var params = {
  deeplink: "gopay://..."
};

window.gpContainer.call(  
  "GP",  
  "launchPayment",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    success: true,
    data: {
        status: "success"
    },
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "300",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "Permission denied",
    "ret": "GP_EXCEPTION"   
}
StatusDescription
successUser have successfully paid the transaction
failedUser cancelled the transaction
pendingThere's an error processing the transaction
cancelledUser goes back to the miniapp without completing or cancelling the payment

Launch Uri

Sample Request:

var params = {
  uri: "string"
};

window.gpContainer.call(  
  "GPNavigator",  
  "launchUri",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "300",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "Permission denied",
    "ret": "GP_EXCEPTION"   
}


CopyToClipboard

Sample Request:

var params = {
        text: "string"
        };

window.gpContainer.call(  
  "GPBase",  
  "copyToClipboard",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

isInstall

Sample Request:

var params = {
        // The app label that is used in iOS.
        ios: 'gopay://',
        // The app label that is used in Android.
        android: 'com.gopay.gopay'
        };

window.gpContainer.call(  
  "GPBase",  
  "isInstall",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

isAppsInstalled

Sample Request:

var params = {
        gopay: {
                ios: 'gopay://',
                android: 'com.gopay.gopay'
        },
        gojek: {
                ios: 'gojek://',
                android: 'com.gojek.gojek'
        }
        };

window.gpContainer.call(  
  "GPBase",  
  "isAppsInstalled",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

notify

Sample Request:

var params = {
        // The name of the event
        event: 'MyNotifyName',
        // The parameters of the event
        param: { MyEventParam: 'paramValue' 
        };

window.gpContainer.call(  
  "GPBase",  
  "notify",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

document.addEventListener('MyNotifyName', function(e) {
        alert(JSON.stringify(e.param));
}, false);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}
{
    "success": true,
		"ret": "GP_SUCCESS"
}

openBrowser

Sample Request:

var params = {
        // The URL that is displayed in browser.
        url: 'http://www.gopay.com'
        };

window.gpContainer.call(  
  "GPBase",  
  "openBrowser",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

setBackgroundColor

Sample Request:

var params = {
        color: 'FF0000',
        alpha: 0.3
        };

window.gpContainer.call(  
  "GPBase",  
  "setBackgroundColor",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

canIUse

Sample Request:

var params = {
        api: 'GPMotion',
        method: 'vibrate'
        };

window.gpContainer.call(  
  "GPBase",  
  "canIUse",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

close

Sample Request:

window.gpContainer.call(  
  "GPMiniApp",  
  "close",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

pop

Sample Request:

window.gpContainer.call(  
  "GPNavigator",  
  "pop",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

push

Sample Request:

var params = {
        url: 'xxxx'
        };

window.gpContainer.call(  
  "GPNavigator",  
  "push",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

showLoadingBox

Sample Request:

window.gpContainer.call(  
  "GPUI",  
  "showLoadingBox",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

hideLoadingBox

Sample Request:

window.gpContainer.call(  
  "GPUI",  
  "hideLoadingBox",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

hideKeyboard

Sample Request:

window.gpContainer.call(  
  "GPUI",  
  "hideKeyboard",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

toast

Sample Request:

var params = {
        // The toast message that you want to display.
        message: 'Toast information',
        // The duration for which the toast message is displayed.
        duration: 5
        };

window.gpContainer.call(  
  "GPUIToast",  
  "toast",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

alert

Sample Request:

var params = {
        // The warning message that you want to display.
        message: 'Hello World!',
        // The OK button in the warning message.
        okbutton: 'OK',
        };

window.gpContainer.call(  
  "GPUIDialog",  
  "alert",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

confirm

Sample Request:

var params = {
// The confirmation message that you want to display.
message: 'Are you really really sure?',
// The OK button in the confirmation message.
 okbutton: 'OK',
// The Cancel button in the confirmation message.
canclebutton: 'Cancel',
// The index of the confirmation message.
_index: 10086
        };

window.gpContainer.call(  
  "GPUIDialog",  
  "confirm",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

document.addEventListener('gp.dialog', function(e) {
alert(JSON.stringify(e.param));
}, false);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

enableAlertBeforeUnload

Sample Request:

var params = {
    // The content in the dialog.
    message: 'Confirm to leave?',
        };

window.gpContainer.call(  
  "GPUI",  
  "enableAlertBeforeUnload",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

disableAlertBeforeUnload

Sample Request:

window.gpContainer.call(  
  "GPUI",  
  "disableAlertBeforeUnload",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

prompt

Sample Request:

var params = {
  	    title: 'prompt message'
        message: 'Enter xxx'
  		  hint: 'Enter xxx'
        okbutton: 'OK',
  		  cancelbutton: 'Cancel'
        };

window.gpContainer.call(  
  "GPUIDialog",  
  "prompt",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

showAuthGuide

Sample Request:

var params = {
  	    permission: 'Address book'
  		  cancelbutton: 'Cancel'
        };

window.gpContainer.call(  
  "GPUIDialog",  
  "showAuthGuide",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

show

Sample Request:

var params = {
        // The title of the action sheet.
        title: 'Choose a button!',
        // The index of the action sheet.
        _index: 32768,
        // The buttons that are displayed in the action sheet.
        buttons: ['Button 1', 'Button 2', 'Button 3', 'Button 4', 'Button 5']
        };

window.gpContainer.call(  
  "GPUIActionSheet",  
  "show",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

document.addEventListener('gp.actionsheet', function(e) {
        alert(JSON.stringify(e.param));
}, false);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

update

Sample Request:

var params = {
  title: 'Home',
  titleColor: '#FF00FF',
  barStyle: 'float',
  backgroundColor: '#00FFFF',
  hideBackButton: 'false'
        };

window.gpContainer.call(  
  "GPNavigationBar",  
  "update",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

getHeight

Sample Request:

window.gpContainer.call(  
  "GPNavigationBar",  
  "getHeight",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

saveImage

Sample Request:

var params = {
    // The URL of the image to be saved.
    url: 'https://gw.xxx.com/xxx/xxx.png',  
        };

window.gpContainer.call(  
  "GPImage",  
  "saveImage",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

chooseVideo

Sample Request:

var params = {
  mode: 'both'
        };

window.gpContainer.call(  
  "GPVideo",  
  "chooseVideo",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

document.addEventListener('GPVideo.Event.chooseVideoSuccess', function (e) {
        alert('event chooseVideoSuccess: ' + JSON.stringify(e.param));
});
document.addEventListener('GPVideo.Event.chooseVideoFailed', function (e) {
        alert('event chooseVideoSuccess: ' + JSON.stringify(e.param));
});

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

saveVideoToPhotosAlbum

Sample Request:

var params = {
  url: 'http://xxxx'
        };

window.gpContainer.call(  
  "GPVideo",  
  "saveVideoToPhotosAlbum",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

document.addEventListener('GPVideo.Event.saveVideoSuccess', function (e) {
        alert('event saveVideoSuccess: ' + JSON.stringify(e.param));
});
document.addEventListener('GPVideo.Event.saveVideoFailed', function (e) {
        alert('event saveVideoFailed: ' + JSON.stringify(e.param));
});

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

playSystemSound

Sample Request:

var params = {
        // The ID of the system sound that you want to play.
        sound: 1000
        // The number of times that you want the sound to be played consecutively.
        count: 3
        };

window.gpContainer.call(  
  "GPAudio",  
  "playSystemSound",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

[Sound Table]


takePhoto

Sample Request:

var photoLocalPath; // The path to save the local file. 
var params = {
        mode: 'both',
        };

window.gpContainer.call(  
  "GPCamera",  
  "takePhoto",  
  params,  
  function(response) {  
    var uploadParams = {
            // The path in which the photo you want to upload is saved.
            path: e.localPath
      };
      // Implement the transmission of file to the backend service for file storage.
      ...
      ...
			console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

[need to double check]


setItem

Sample Request:

var params = {
  key: 'key',
  value: 'value'
        };

window.gpContainer.call(  
  "GPStorage",  
  "setItem",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

getItem

Sample Request:

var params = {
  		key: 'key'
        };

window.gpContainer.call(  
  "GPStorage",  
  "getItem",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

removeItem

Sample Request:

var params = {
  key: 'key'
        };

window.gpContainer.call(  
  "GPStorage",  
  "removeItem",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

clearStorage

Sample Request:

window.gpContainer.call(  
  "GPStorage",  
  "clearStorage",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

clearStorageSync

Sample Request:

window.gpContainer.call(  
  "GPStorage",  
  "clearStorageSync",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

write

Sample Request:

var params = {
        mode: 'overwrite',
        data: 'Hello World!!!\n',
        fileName: 'testFile.txt',
        share: 'false'
        };

window.gpContainer.call(  
  "GPFile",  
  "write",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

read

Sample Request:

var params = {
        fileName: 'testFile.txt',
        share: 'false'
        };

window.gpContainer.call(  
  "GPFile",  
  "read",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

getFileInfo

Sample Request:

var params = {
        filePath: '/storage/emulated/0/Android/data/xxx/testFile.txt',
        };

window.gpContainer.call(  
  "GPFile",  
  "getFileInfo",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

downloadFile

Sample Request:

var params = {
    url: 'http://xxxx',
  	name: 'test.mp4'
        };

window.gpContainer.call(  
  "GPFile",  
  "downloadFile",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

document.addEventListener('GPFile.Event.downloadFileSuccess', function (e) {
        alert('event downloadFileSuccess: ' + JSON.stringify(e.param));
});
document.addEventListener('GPFile.Event.downloadFileFailed', function (e) {
        alert('event downloadFileFailed: ' + JSON.stringify(e.param));
});

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

uploadFile

Sample Request:

var params = {
    url: 'http://xxxx',
  	filePath: '/storage/test.txt',
    timeout: 8000,
    headers: {
       xxx: 'xxx'
    }
        };

window.gpContainer.call(  
  "GPFile",  
  "uploadFile",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

document.addEventListener('GPFile.Event.uploadFileSuccess', function (e) {
        alert('event uploadFileSuccess: ' + JSON.stringify(e.param));
});
document.addEventListener('GPFile.Event.uploadFileFailed', function (e) {
        alert('event uploadFileFailed: ' + JSON.stringify(e.param));
});

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

searchLocation

Sample Request:

var params = {
        // The address that you want to search for.
        addrs: ' No.960 xxxx West Road'
        };

window.gpContainer.call(  
  "GPLocation",  
  "searchLocation",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

readCookie

Sample Request:

var params = {
        // The URL from which you want to read cookies.
        url: 'http://xxx.com'
        };

window.gpContainer.call(  
  "GPCookie",  
  "read",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

writeCookie

Sample Request:

var params = {
				// The cookie that you want to write. The cookie name is cookieKey and the value is cookieValue in the following sample code. 
        cookieKey: 'cookieValue',
        domain: 'h5.m.taobao.com',
        };

window.gpContainer.call(  
  "GPCookie",  
  "write",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

getSystemInfo

Sample Request:

window.gpContainer.call(  
  "GPSystem",  
  "getSystemInfo",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

getSystemInfoSync

Sample Request:

window.gpContainer.call(  
  "GPSystem",  
  "getSystemInfoSync",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

isSimulator

Sample Request:

window.gpContainer.call(  
  "GPNativeDetector",  
  "isSimulator",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

getCurrentUsage

Sample Request:

window.gpContainer.call(  
  "GPNativeDetector",  
  "getCurrentUsage",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

getDeviceYear

Sample Request:

window.gpContainer.call(  
  "GPNativeDetector",  
  "getDeviceYear",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

getModelInfo

Sample Request:

window.gpContainer.call(  
  "GPNativeDetector",  
  "getModelInfo",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

getSafeAreaInsets

Sample Request:

window.gpContainer.call(  
  "GPNativeDetector",  
  "getSafeAreaInsets",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

getNetworkType

Sample Request:

window.gpContainer.call(  
  "GPNetwork",  
  "getNetworkType",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

getOrientation

Sample Request:

window.gpContainer.call(  
  "GPScreen",  
  "getOrientation",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

setOrientation

Sample Request:

var params = {
        orientation: 'landscape'
        };

window.gpContainer.call(  
  "GPScreen",  
  "setOrientation",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

setScreenBrightness

Sample Request:

var params = {
       brightness: '100'
        };

window.gpContainer.call(  
  "GPScreen",  
  "setScreenBrightness",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

getScreenBrightness

Sample Request:

window.gpContainer.call(  
  "GPScreen",  
  "getScreenBrightness",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

capture

Sample Request:

var params = {
        // Specify whether to save the screenshot as an image file in the album.
        inAlbum: 'true'
        };

window.gpContainer.call(  
  "GPScreenCapture",  
  "capture",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

listenBlow

Sample Request:

window.gpContainer.call(  
  "GPMotion",  
  "listenBlow",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

document.addEventListener('motion.blow', function(e) {
        alert('A blow gesture is detected.');
}, false);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

stopListenBlow

Sample Request:

window.gpContainer.call(  
  "GPMotion",  
  "stopListenBlow",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

listenGyro

Sample Request:

var params = {
        // Enable or disable monitoring of the gyroscope.
        on: true,
        // The interval between gyroscope events.
        frequency: 100
        };

window.gpContainer.call(  
  "GPMotion",  
  "listenGyro",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

document.addEventListener('motion.gyro', function(e) {
        alert ('A change in the phone orientation is detected.');
}, false);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

listeningShake

Sample Request:

var params = {
        // Enable or disable shake gesture monitoring.
        on: true
        };

window.gpContainer.call(  
  "GPMotion",  
  "listeningShake",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

document.addEventListener('motion.shake', function(e) {
        alert ('A shake gesture is detected.');
}, false);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

vibrate

Sample Request:

var params = {
        // The vibration duration.
        duration: 7000
        };

window.gpContainer.call(  
  "GPMotion",  
  "vibrate",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

startAccelerometer

Sample Request:

var params = {
  interval: 'normal'
        };

window.gpContainer.call(  
  "GPMotion",  
  "startAccelerometer",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

document.addEventListener('GPMotion.Event.accelerometer', function (e) {
        alert('event accelerometer: ' + JSON.stringify(e.param));
});

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

stopAccelerometer

Sample Request:

window.gpContainer.call(  
  "G{Motion",  
  "stopAccelerometer",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

StartCompass

Sample Request:

var params = {
/**
interval is either "game", "ui", or "normal". "normal" is default
"game" : 20ms
"ui": 60ms
"normal": 200ms
*/
  interval: 'normal'
};

window.gpContainer.call(  
  "GPMotion",  
  "startCompass",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

// Listen to Compass result
document.addEventListener('GPMotion.Event.compass', (e: GPMotionCompassData) => {
  console.log('Received gpAsyncCallback event:', JSON.stringify(e));
});

Sample Response: (error codes)

{
    "success": true,
    "ret": "GP_SUCCESS",
		"msg": "COMPASS_STARTED"
}
{
    direction: double, // The value due north between [0,360)
    timestamp: int64
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

StopCompass

Sample Request:

window.gpContainer.call(  
  "GPMotion",  
  "stopCompass",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS",
		"msg": "COMPASS_STOPPED"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

beep

Sample Request:

var params = {
        // The number of consecutive beeps.
        count: 3
        };

window.gpContainer.call(  
  "GPNotification",  
  "beep",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

dial

Sample Request:

var params = {
  phone: '1320000000',
        };

window.gpContainer.call(  
  "GPCall",  
  "dial",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

call

Sample Request:

var params = {
  phone: '1320000000',
        };

window.gpContainer.call(  
  "GPCall",  
  "call",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

appState

Sample Request:

window.gpContainer.call(  
  "GPApplication",  
  "appState",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

getNotificationSettings

Sample Request:

window.gpContainer.call(  
  "GPApplication",  
  "getNotificationSettings",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

openSettings

Sample Request:

window.gpContainer.call(  
  "GPApplication",  
  "openSettings",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}


askAuth

Sample Request:

window.gpContainer.call(  
  "GPContacts",  
  "askAuth",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

authStatus

Sample Request:

window.gpContainer.call(  
  "GPContacts",  
  "authStatus",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

choose

Sample Request:

window.gpContainer.call(  
  "GPContacts",  
  "choose",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

find

Sample Request:

var params = {
        // The contact filter.
        filter: {
                // Search for a contact with a specified name.
                name: 'Jack',
                // Search for a contact with a specified phone number.
                phone: '123456'
        };

window.gpContainer.call(  
  "GPContacts",  
  "find",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

addPhoneContact

Sample Request:

var params = {
  lastName: 'xxx',
  firstName: 'xxx',
  middleName:'xxx',
  nickName: 'xxx',
  remark: 'xxx',
  mobilePhoneNumber: '+86 12345',
  hostNumber: '12345',
  address: 'Beijing Chaoyang',
  email: '[email protected]',
  organization: 'xxx',
  title: 'xxx',
  photoPath: '/storage/emulated/0/DCIM/Camera/xxx.jpg
        };

window.gpContainer.call(  
  "GPContacts",  
  "addPhoneContact",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

scan

Sample Request:

var params = {
  openFlight: true,
  title: 'XXX'
        };

window.gpContainer.call(  
  "GPScan",  
  "scan",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

document.addEventListener('GPScan.Event.scanSuccess', function (e) {
        alert('event scanSuccess: ' + JSON.stringify(e.param));
});
document.addEventListener('GPScan.Event.scanFailed', function (e) {
        alert('event scanFailed: ' + JSON.stringify(e.param));
});

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

getBatteryInfo

Sample Request:

window.gpContainer.call(  
  "GPBattery",  
  "getBatteryInfo",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

getBatteryInfoSync

Sample Request:

window.gpContainer.call(  
  "GPBattery",  
  "getBatteryInfoSync",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

requestAuthorization

Sample Request:

window.gpContainer.call(  
  "GPBluetooth",  
  "requestAuthorization",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

scanBluetooth

Sample Request:

var params = {
        text: "string"
        };

window.gpContainer.call(  
  "GPBluetooth",  
  "scan",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);
document.addEventListener('GP.Event.GPBluetooth.discoverDevice', function (e) {
        alert('event discoverDevice: ' + JSON.stringify(e.param));
});

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

stopScan

Sample Request:

window.gpContainer.call(  
  "GPBluetooth",  
  "stopScan",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

connect

Sample Request:

var params = {
  deviceId: '00:aa:bb:cc:dd'
        };

window.gpContainer.call(  
  "GPBluetooth",  
  "connect",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

disconnect

Sample Request:

window.gpContainer.call(  
  "GPBluetooth",  
  "disconnect",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);
document.addEventListener('GP.Event.GPBluetooth.GATTServerDisconnected', function (e) {
        alert('event GATTServerDisconnected: ' + JSON.stringify(e.param));
});

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

getServices

Sample Request:

var params = {
  deviceId: '00:aa:bb:cc:dd'
        };

window.gpContainer.call(  
  "GPBluetooth",  
  "getServices",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

getCharacteristics

Sample Request:

var params = {
  deviceId: '00:aa:bb:cc:dd', 
  serviceId: 'xxxx'
        };

window.gpContainer.call(  
  "GPBluetooth",  
  "getCharacteristics",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

writeValue

Sample Request:

var params = {
  deviceId: '00:aa:bb:cc:dd', 
  serviceId: 'xxxx',
  characteristicId: 'xxx',
  value: 'xxx'
        };

window.gpContainer.call(  
  "GPBluetooth",  
  "writeValue",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

readValue

Sample Request:

var params = {
  deviceId: '00:aa:bb:cc:dd', 
  serviceId: 'xxxx',
  characteristicId: 'xxx',
        };

window.gpContainer.call(  
  "GPBluetooth",  
  "readValue",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

startNotifications

Sample Request:

var params = {
  deviceId: '00:aa:bb:cc:dd', 
  serviceId: 'xxxx',
  characteristicId: 'xxx',
        };

window.gpContainer.call(  
  "GPBluetooth",  
  "startNotifications",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

stopNotifications

Sample Request:

var params = {
  deviceId: '00:aa:bb:cc:dd', 
  serviceId: 'xxxx',
  characteristicId: 'xxx',
        };

window.gpContainer.call(  
  "GPBluetooth",  
  "stopNotifications",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

postNotificationToNative

IOS event listeners

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myEventListener) name:eventName object:nil]

- (void)myEventListener:(NSNotification *)notification {
        // Specify to obtain the event parameters from notification.userInfo. 
}

Android event listener

@import android.taobao.windvane.service;
@import android.taobao.windvane.standardmodal

// Implement a listener. 
public class JsEventListener implements GPEventListener {
        @Override
        public GPEventResult onEvent(int id, GPEventContext ctx, Object... obj) {
                // All events are sent to the listener. GPEventId.H5TONATIVE_EVENT indicates the events sent by HTML5 apps or MiniApps. 
                if (id == GPEventId.H5TONATIVE_EVENT) {
                        if (obj[0] instanceof String) {
                                String params = (String)obj[0];
                                // params is a JSON string that contains two parameters – event and param. You need to deserialize the string. 
                        }
                }
                return null;
        }
}

// Register a listener. 
GPEventService.getInstance().addEventListener(new JsEventListener());

Sample Request:

var params = {
        event: 'eventName',
        param: {
                // The data of the event to be sent. 
        }
        };

window.gpContainer.call(  
  "GPStandardEventCenter",  
  "postNotificationToNative",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

Background

Sample Request:

document.addEventListener('GP.Event.APP.Background', function(e) {
        // For some models, an alert is triggered when the app exits, which will cause a system bug. 
        console.log('Event Background');
}, false);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

Active

Sample Request:

document.addEventListener('GP.Event.APP.Active', function(e) {
        alert('Event Active');
}, false);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

Pull Refresh

Sample Request:

//In the iOS system, WindVane enables the pull-to-refresh feature by default. To disable pull-to-refresh, add the following metadata to the <head> element of HTML:
<meta id="stopUsePullRefresh" value="true">
//You can specify whether to display the URL of the current page in the prompt section when a pull-to-refresh action is taken. To display the URL of the current page, add the following metadata to the <head> element of HTML:
<meta id="urlInLaw" value="true">

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

Infinite Scroll

//Loads more content when the user scrolls to the bottom of the page. To enable infinite scrolling, add the following metadata to the <head> element of HTML:
<meta id="infiniteScroll" value="true">
//In GoPay Container SDK of the iOS system, add the following metadata to the <head> element of HTML:
<meta id="urlInLaw" value="true">

Sample Request:

document.addEventListener('GP_INFINIT_SCROLL', function(e) {
        var data = 'New document element for infinit scroll';
        window.gpContainer.call('GPScrollWidget', 'hiddenInfinitScroll', {}, function(e) {
                var newDiv = document.createElement('div');
                newDiv.innerHTML = data;
                document.body.appendChild(newDiv);
        });
}, false);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "errorCode": "",
    "errorType": "JS_BRIDGE_ERROR",
    "errorMessage": "",
    "ret": "GP_EXCEPTION"   
}

Error Codes

CodesDescription
'GP_SUCCESS'Indicates that the API call is successful. This value is used only in a success callback.
'GP_CLOSED'Indicates that the JSBridge feature is forcibly disabled. In most cases, this issue occurs because the URL of the page is not specified in the list of trusted domains or the JSBridge feature is not enabled for native apps. If this issue occurs, check the URL or contact HTML5 container-native developers to troubleshoot the issue.
'GP_NO_HANDLER'Indicates that the current client does not provide this API. Check whether the called JSBridge is correct and contact the provider of the native apps for JSBridge to troubleshoot the issue.
'GP_PARAM_ERR'Indicates that the input parameter is invalid. Make sure that the input parameter is valid.
'GP_NO_PERMISSION'Indicates that the current page does not have permissions to call this API.
'GP_FAILED'Indicates that the API call fails. Contact the provider of the native apps for JSBridge to troubleshoot the issue.
'GP_EXCEPTION'Indicates that an error occurs when the API is called. Contact the provider of the native apps for JSBridge to troubleshoot the issue.
'GP_USER_DENIED'Indicates that the API is not granted the permissions to perform the operation. For example, a client wants to call this API to access the album, but the client is not allowed to access the album.
'GP_USER_CANCELLED'Indicates that the user canceled the current API request.
'GP_RET_PHOTO_CANCEL'Indicates that the user cancels the request for taking photos by using the API provided by GPCamera.
'GP_TIMEOUT'Indicates that the call of JSBridge times out.
'GP_RESULT_PARSE_ERROR'Indicates that the format of the data passed by native apps to HTML5 is invalid.
'GP_NOT_IN_WINDVANE'Indicates that the current environment is not WindVane such as a browser, or that UserAgent of WindVane provided by the client is invalid. Alternatively, JavaScript of the page incorrectly modified an environment variable in the windvane.js file. For example, WindVane.isAvailable is set to false.
'GP_NOT_SUPPORT_DEVICE'Indicates that JSBridge is called on a device or in an environment that is not supported, such as a browser. Alternatively, a JavaScript action on the page incorrectly modified an environment variable in the windvane.js file. For example, WindVane.isAvailable is set to false.
'GP_NO_HANDLER_ON_WP'Indicates that JSBridge is called on a Windows device or in an environment that is not supported, such as a browser.
'GP_ERR::PARAM_PARSE_ERROR'Indicates that the format of the data passed by native apps to HTML5 is invalid.