Blueforcer Well-Known Member Licensed User Longtime User Oct 22, 2020 #1 My App https://www.b4x.com/android/forum/threads/ambilight.96597/ controls some light and stays in the tray all the time. Now i want to turn off the lights when the user shutdown his PC. Is there a way to detect this?
My App https://www.b4x.com/android/forum/threads/ambilight.96597/ controls some light and stays in the tray all the time. Now i want to turn off the lights when the user shutdown his PC. Is there a way to detect this?
Daestrum Expert Licensed User Longtime User Oct 23, 2020 #2 Have a look at this post by Erel https://www.b4x.com/android/forum/threads/open-com-port-after-program-termination.108184/post-676346 It may give you some ideas. Upvote 0
Have a look at this post by Erel https://www.b4x.com/android/forum/threads/open-com-port-after-program-termination.108184/post-676346 It may give you some ideas.
OliverA Expert Licensed User Longtime User Oct 23, 2020 #3 Blueforcer said: Is there a way to detect this? Click to expand... From my "quick" testing, no. @Deastrum's linked solution works under Windows when using CTRL-C to interrupt the program in a DOS command line session. I've not been able to use the solution to detect shutdowns via Task Manager, user logout, or system shutdowns. It does seem to work fairly well under Linux using the standard kill command, stopping it under systemd and shutting down/restarting Linux (tested on Ubuntu Server 18.04LTS). Note: The kill command can be used with various options that can be used to stop the .jar file without evoking the shutdown hook (and may be configured in such a way on other distributions). Upvote 0
Blueforcer said: Is there a way to detect this? Click to expand... From my "quick" testing, no. @Deastrum's linked solution works under Windows when using CTRL-C to interrupt the program in a DOS command line session. I've not been able to use the solution to detect shutdowns via Task Manager, user logout, or system shutdowns. It does seem to work fairly well under Linux using the standard kill command, stopping it under systemd and shutting down/restarting Linux (tested on Ubuntu Server 18.04LTS). Note: The kill command can be used with various options that can be used to stop the .jar file without evoking the shutdown hook (and may be configured in such a way on other distributions).
Blueforcer Well-Known Member Licensed User Longtime User Oct 24, 2020 #4 while my testing , out of 5 stop calls it has called shutdown hook only once on windows shutdown Upvote 0