How to check whether application is foreground or background?

■ Summary

Now Tizen Web Developer cannot control the lifecycle of the web application.
But if developer uses the blur and focus event, developer can manage the application status of the foreground and background.
// Background
window.addEventListener('blur',function(){
    // TODO Something
    // ex) Stop the background sound
    console.log("blur");
});
 
 
// Foreground 
window.addEventListener('focus',function(){
    // TODO Something
    // ex) Play the background sound
    console.log ("focus");
});

Responses

0 Replies