Phonegap 设备就绪事件

发布于 2024-12-08 21:42:54 字数 237 浏览 3 评论 0原文

我有一个关于此事件的问题,deviceready。

document.addEventListener('deviceready', function() {
    app.init();
}, false);

看来每次设备(我正在使用 Android 2.3)向侧面倾斜(以便显示变为宽屏)时都会触发该事件。我想这是预期的行为,但是有什么方法可以阻止它,因为我的应用程序只需要初始化一次?

I have a question regarding this event here, deviceready.

document.addEventListener('deviceready', function() {
    app.init();
}, false);

It appears the event is fired every time the device (I'm working on Android 2.3) is tilted to the side (So that the display changes to wide). I guess this is the intended behavior, but is there any way to prevent it, as my application needs to be initialized only once?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乜一 2024-12-15 21:42:54

以下是解决方案的链接

如何在 Android 上禁用方向更改?

通过添加

android:configChanges="keyboardHidden|orientation"

到 AndroidManifest.xml 文件中的 Activity,它告诉应用程序您将自己处理 configChanges。

Here is a link to the solution

How do I disable orientation change on Android?

By adding

android:configChanges="keyboardHidden|orientation"

to your activity in the AndroidManifest.xml file, it tells the app that you will handle the configChanges yourself.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文