科尔多瓦 (Android) 设备运动和设备方向 (W3C) 不可用



我正在尝试在 Cordova 应用程序中使用 W3C 设备方向和设备运动,因为插件现已弃用。但是,添加此代码段时,window中没有定义DeviceOrientationEvent,也没有触发事件:

window.addEventListener("deviceorientation", function(event) {
// process event.alpha, event.beta and event.gamma
}, true);

以下是我的安卓设备的一些规格:

Device model: JSN-L23
Cordova version: 8.0.0
Device platform: Android
Device manufacturer: HUAWEI
Device version: 9
WebGL support: true
User agent: Mozilla/5.0 (Linux; Android 9; JSN-L23 Build/HONORJSN-L23; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.132 Mobile Safari/537.36
Android WebView package name: com.google.android.webview
Android WebView version code: 372913600
Android WebView version name: 74.0.3729.136

在设备就绪之外使用,不知何故,在触发设备就绪后,此事件从 Windows 对象中消失

最新更新