1

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

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

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

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
4

1 回答 1

0

在 ondeviceready 外部使用,在触发 deviceready 后,此事件以某种方式从 windows 对象中消失

于 2020-08-06T11:27:38.337 回答