android - Cordova - detect that app is in the background -


i have feature in cordova app lets user when user shakes phone (i'm using shake.js purpose). phone vibrates when happens.

the problem that, when "alt tab" away app , it's in background, shake/vibrate combo still works. user might using different app , phone still vibrate.

is there way detect app in background, or better yet, freeze app somehow when it's going background?

i have problem on android (haven't tested on ios yet).

you can bind pause event , remove shake feature app. according documentation (pause) event fires when application put background.

you can listen resume event put shake feature. usual in documentation can find complete code examples.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -