All Products
Search
Document Center

SuperApp:Device environment detection

Last Updated:Jun 02, 2026

JavaScript APIs of the WVNativeDetector class for H5 applications and mini programs. Use these APIs to retrieve device information such as the model, CPU usage, and memory usage.

WVNativeDetector.isSimulator

Checks whether the current environment is a simulator.

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

Input parameters

None.

Callback parameters

Returns the result in the success callback on success, or the failure callback on error.

  • [boolean] isSimulator: true if the current environment is a simulator; false otherwise.

WVNativeDetector.getCurrentUsage

Retrieves the current CPU and memory usage.

Note

Calling this API incurs a performance overhead. Call it only when necessary.

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

Input parameters

None.

Callback parameters

Returns the results in the success callback on success, or the failure callback on error.

  • [number] cpuUsage: Current CPU usage.

  • [number] memoryUsage: Current memory usage, calculated as usedMemory / totalMemory.

  • [number] usedMemory: Total memory in use on the device, including memory used by the current app and other open apps. Unit: MB.

  • [number] totalMemory: Total physical memory of the device. Unit: MB.

WVNativeDetector.getDeviceYear

Retrieves the device's release year to help estimate its performance tier. On iOS, the result is exact. On Android, it is an estimate.

Devices released in 2012 or later meet most performance requirements.

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

Input parameters

None.

Callback parameters

Returns the result in the success callback on success, or the failure callback on error.

  • [number] deviceYear: Release year of the device. Example: 2012.

WVNativeDetector.getModelInfo

Retrieves the device brand and model. The platform and platformName fields are available on WindVane iOS only.

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

Input parameters

None.

Callback parameters

Returns the results in the success callback on success, or the failure callback on error.

  • [string] brand: Device brand. Examples: "Apple", "Google".

  • [string] model: Device model. Examples: "iPhone", "iPod touch", "Nexus 5".

  • [string] platform: Hardware platform identifier. Example: "iPhone5,2". WindVane iOS only.

  • [string] platformName: Human-readable platform name derived from the platform identifier. Example: "iPhone 5 (CDMA)". WindVane iOS only.

WVNativeDetector.getSafeAreaInsets

Note

This API is available on WindVane iOS only.

Retrieves the safe area insets for the current full-screen page. Use this API to lay out content correctly on iPhone X and later devices running iOS 11 or later.

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

Input parameters

None.

Callback parameters

Returns the results in the success callback on success, or the failure callback on error.

  • [number] top: Top inset of the safe area.

  • [number] left: Left inset of the safe area.

  • [number] bottom: Bottom inset of the safe area.

  • [number] right: Right inset of the safe area.

  • [boolean] cssAvaliable: true if the constant(safe-area-inset-*) CSS function is supported. This indicates iOS 11 or later and a client app built with Xcode.