I asked this question about how to capture visibility changes in a metro app:
How to tell if JS Windows8 metro app is visible or not
And it seems like there two answers:
1) checkpoint will be called about 10 seconds after the app loses focuses because the app will be suspended
2) the page visibility events will work.
However, when I do the following in my default.js I don’t see either of these things happening:
var onVisibilityChange = function (args) {
console.log("Visibility changed. (this will never appear");
};
app.addEventListener("visibilitychange", onVisibilityChange);
// ...
app.oncheckpoint = function (args) {
console.log("APP onCheckpoint (this also never appears");
};
Does anybody have an example of capturing when the app starts/stops being visible that works?
For visibility, you need to use the document:
For Checkpoint, your code is correct but note: