Describes the WVApplication JavaScript APIs for H5 applications and mini programs, including APIs for querying the app lifecycle state, checking notification authorization status, and opening system settings.
WVApplication.appState
This API applies only to WindVane for iOS.
Returns the current lifecycle state of the application. Call this API to determine whether your app is active, in the background, or transitioning between states — for example, to pause or resume work when the app loses focus.
Input parameters
None.
Callback parameters
On success, the success callback is executed. On failure, the failure callback is executed.
-
state(string): The current app lifecycle state. Valid values:'active': The app is running in the foreground and receiving events.'inactive': The app is in the foreground but not receiving events. This occurs during transitions — for example, when the user opens the Notification Center, switches apps via the App Switcher, or receives an incoming call.'background': The app is running in the background.'unknown': The app state cannot be determined.
window.WindVane.call('WVApplication', 'appState', {}, function(e) {
alert('success: ' + JSON.stringify(e));
}, function(e) {
alert('failure: ' + JSON.stringify(e));
});
WVApplication.getNotificationSettings
This API applies only to WindVane for iOS.
Returns the notification authorization status for the current application. Call this API to check whether the user has granted notification permission — for example, to enable or disable notification-related features in your app, or to prompt users to update their settings when permission is denied.
Input parameters
None.
Callback parameters
On success, the success callback is executed. On failure, the failure callback is executed.
-
status(string): The notification authorization status. Valid values:'authorized': The user has granted the app permission to display notifications.'denied': The user has denied the app permission to display notifications.'notDetermined': The user has not yet responded to the notification permission prompt. This value may be returned on iOS before the app has requested notification permissions.'unknown': The notification status cannot be determined.
window.WindVane.call('WVApplication', 'getNotificationSettings', {}, function(e) {
alert('success: ' + JSON.stringify(e));
}, function(e) {
alert('failure: ' + JSON.stringify(e));
});
WVApplication.openSettings
This API applies only to WindVane for iOS.
Opens the system settings page for the current application. Use this API to direct users to their app settings — for example, after getNotificationSettings returns 'denied', to let users re-enable notifications.
Input parameters
type(string, optional): The settings page to open. Valid value:'Notification'— opens the notification settings page. On iOS, the system opens the main app settings page regardless of this value. If omitted, the main app settings page opens.
Callback parameters
This method has no return values in the callback. On success, the success callback is executed. On failure, the failure callback is executed.
window.WindVane.call('WVApplication', 'openSettings', {}, function(e) {
alert('success: ' + JSON.stringify(e));
}, function(e) {
alert('failure: ' + JSON.stringify(e));
});