Languages

Menu
Sites
Language
How can I know app is background with home button//홈버튼에의해 앱이 백그라운드에 가는것을 판단하는방법

by pressing power(home) key once, app goes to background. 

but I need to know when app go to background.
is there a any method like viewDidLeave() .

the reason is that on app I make screen not to be off. but when app is on background, it's still valid so screen is remain on . 
I think I should do some work to screen to be off when app is background. 

 


webapp

/////////
파워 버튼 눌러서 앱이 백그라운드로 가는걸 detect해야합니다. 방법이없을까요? 아무리 봐도  문서에는 안나오네요
앱에서 특정행동시, 스크린이 켜짐을 유지하도록 했는데 이게 홈(파워) 키를 통해 백그라운드에서 앱이 돌아갈때도 유지가 되네요...
이걸 막으려면 뭔가 코드상에서 뷰가 나가질때 코드를 추가해야하는데 못찾겠습니다. 

 


웹앱입니다.

 

 

 

Edited by: pedro j on 30 Nov, 2017

Responses

1 Replies
Armaan-Ul- Islam

Hello pedro j,

You can use widow.onblur and widow.onblur for the desired functionality in Tizen Web application.

 

Sample Code:

window.onblur = function(){
    console.log("Gone to background....");
};

window.onfocus = function(){
    console.log("Back in Foreground....");
};