Languages

Menu
Sites
Language
How to detect time out and user press the Home key?

I received feedback from Samsung that my game needs to stop sound automatically when:

- system time out and went to watch face

- when user press the Home key

How do I detect those events? And how do I resume? Thanks!

Edited by: Thye Chean Lim on 21 Feb, 2017

Responses

3 Replies
Iqbal Hossain

hi Thye Chean Lim

Which game engine are you using ? I think it depends on game engine. 
If you using Canvas, you can use Tizen back key event to detect Exit event.  

-thanks

Thye Chean Lim

Hi,

I am not using any game engine. Just using canvas, it cannot detect time out. Exit will work but Home key cannot be detected.

I tried this to detect ambient mode

document.addEventListener("ambientmodechanged", function(ev)  {

  var mode = ev.detail.ambientMode; 

  

    if (mode == true) {

    stopMusic();

  }

});

 

Slawek Kowalski

You need to detect app goes background and back foregaround. Just it.