visibilitychange in mobile safari standalone mode

谁都会走 提交于 2021-01-28 09:05:03

问题


The Visibility API doesn't work in standalone mode on iOS.

I need to know if the phone was unlocked with my app in the foreground so that I can check for an update, but nothing seems to work.

I don't get the visibilitychange event. document.hidden is false, and document.visibilityState is "visible" when the phone is locked. I've also found that timers like setTimeout and requestAnimationFrame continue to function while the screen is locked, so I can't use the hacks I've found to detect that state. Has anyone had any success with this? Are there any api's that will fail if the screen is locked?


回答1:


I'm answering here since the system does not let me add a comment. I did search for this also, and did not find this. It worked before iOS 11.0.2, but I guess that does not help you very much.



来源:https://stackoverflow.com/questions/48101355/visibilitychange-in-mobile-safari-standalone-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!