问题
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