Languages

Menu
Sites
Language
[Gear] onclose app?

Hi, I read that there isn't an event to capture if the hardware button is pressed. But there isn't an event to capture the application exiting, too?

I mean: if I click the hardware button the application exits: is it impossible to cature this event? I tried document or window (or even body) onclose or onunload onbeforeunload but no chance ...

BTW I do not use jQuery ...

Thank you.

Responses

3 Replies
Serhii Kolomiiets
Hi, Stefano! Pretty easy. Try this: function onAppToBackground() { console.log('application state -> background'); } window.addEventListener('blur', onAppToBackground); or document.addEventListener('visibilitychange', onAppToBackground);
Stefano Accorsi

TY Sergii, I used the "visibilitychange" way and it works :)

AVSukhov

Hello,

The Tizen Wearable platform supports hardware keys for user interactions. The Tizen Wearable devices provide the Back hardware key.

See documentation "tizenhwkey"

Or you can use visibilitychange" event