All Products
Search
Document Center

SuperApp:Application information

Last Updated:Oct 25, 2024

This topic describes the JavaScript APIs of WVApplication. You can refer to this topic when you create HTML5 apps or Miniapps. You can use the JavaScript APIs of WVApplication to return the status of the app and open the settings page of the app.

WVApplication.appState

Note

This API is available only in WindVane iOS.

Returns the status of the app (whether the app is running in the foreground).

Input parameters

No input parameters exist.

Callback parameters

Callback parameters are passed by using the callback method. If the app status is returned, the success callback is invoked. Otherwise, the failure callback is invoked.

  • [string]state: the status of the app. Valid values:

    • 'active': The app is active in the foreground.

    • 'inactive': The app is inactive in the foreground, such as when the notification bar is pulled down, opening Task Manager by double-tapping the Home key, or when the screen is locked.

    • 'background': The app is running in the background.

    • 'unknown': The app status is unknown.

window.WindVane.call('WVApplication', 'appState', {}, function(e) {
        alert('success: ' + JSON.stringify(e));
}, function(e) {
        alert('failure: ' + JSON.stringify(e));
});

WVApplication.getNotificationSettings

Note

This API is available only in WindVane iOS.

Returns the notification status of the app.

Input parameters

No input parameters exist.

Callback parameters

Callback parameters are passed by using the callback method. If the notification status of the app was returned, the success callback is invoked. Otherwise, the failure callback is invoked.

  • [string]status: the notification status of the app. Valid values:

    • 'authorized': The user has allowed notifications.

    • 'denied': The user has denied notifications.

    • 'notDetermined': The user has not decided whether to allow notifications. This value may be returned before the iOS app has requested notification permission.

    • 'unknown': The notification status of the app is unknown.

window.WindVane.call('WVApplication', 'getNotificationSettings', {}, function(e) {
        alert('success: ' + JSON.stringify(e));
}, function(e) {
        alert('failure: ' + JSON.stringify(e));
});

WVApplication.openSettings

Note

This API is available only in WindVane iOS.

Opens the settings page of the app.

Input parameters

  • [string]type: (optional) the type of settings page that you want to open. If no value is specified, the settings page of the app will be opened. Valid value:

'Notification': specifies to open the notification settings page of the app. The settings page of the app is always displayed in iOS.

Callback parameters

No callback parameters exist. If the settings page was opened, the success callback is invoked. Otherwise, the failure callback is invoked.

window.WindVane.call('WVApplication', 'openSettings', {}, function(e) {
        alert('success: ' + JSON.stringify(e));
}, function(e) {
        alert('failure: ' + JSON.stringify(e));
});