I have an Electron app and I need to log system-wide user activity (e.g. mouse-clicks, keystrokes). Basically, i need to detect if user is AFK if he did nothing in a 5-minute interval, so i can stop the timer inside the app. I'm pretty sure I need to do it with external scripts for each platform (osx, linux, ms). Can you guys suggest me any finished tools or os-level APIs to do it (doesn't matter for which plat) if you know some, or just tell me how you would do it / did it some time.
For all platform monitoring and analysis use GrayLog
https://www.graylog.org/
Related
so I have created a reminder app using React Native and Expo.
I followed the Expo docs which require that you set your app up with Firebase Cloud Messaging even if you're only sending local, scheduled notifications. I also added the exact alarm permission to the android manifest using app.json. Also, the AndroidImportance for the app's notifications channels is set to MAX. Lastly, the Android priority for the notification itself is also set to MAX, as well.
Everything in the app works great, except for one thing:
When the Android device is inactive for a while, the scheduled notifications do not appear at the scheduled time.
I am assuming this is because the device has entered doze mode which is part of Android's battery optimization features. Doze mode can delay notifications.
I am just surprised-- what is the point of a local, scheduled notification feature if it can't even get past doze mode?
I could be overlooking a solution. Does anyone have any ideas? If not, I may have to rewrite a lot of code so that the notifications are not local.
Thanks!
I first tried setting the notification's priority to high, and the notification still wouldn't appear during inactivity. So then I switched the notification's priority to MAX, and that didn't seem to work either.
There is a package on npm for disabling battery optimization in react native apps, but apparently that can get you banned by google, which I'd rather not get banned.
EDIT: One other relevant detail is that when I was at the stage of development early on where I was testing in the Expo Go app, scheduled, local notifications were not affected by doze mode at all. I'd schedule one in the evening, forget about it, and it would come the next morning. I'm wondering if this as an indicator of what needs changing??
So it turns out there are two places where you can set priority to "Notifications.AndroidNotificationPriority.MAX" --
Once when you send the notification, and once when you handle the notification. I had only set it when sending the notification.
For info go to docs Ctrl + F and search for "AndroidNotificationPriority"
I developed a web app to display a slideshow, and want to display it on my secondary monitor (Connected via HDMI) with IE's Kiosk mode on Windows 10. Because of CPU and other resources on the shared server, I want to pause the slideshow when the monitor is powered off. (And therefore nobody is seeing it)
Is there a way to detect connected displays from Internet Explorer? Since this is a one-pc kiosk setup, add-ons, etc. are accepted. Triggering javascript/jquery events would be ideal. Thank you!
No, there is no reliable way to detect if a second monitor is physically switched off but still connected via the cable.
I have to ask though: why do you need to physically switch the second monitor off?
As an alternative could you not:
Have the slideshow stop after a timed duration unless it receives an input?
Have the slideshow only on display at certain times of the day?
Accept events from, say, a node server to control when to and not show the slideshow?
Having said that these threads could provided you, albeit unreliably apparently, what you need:
Is there any way to detect the monitor state in Windows (on or off)?
Monitoring a displays state in python?
You can't do in javascript. Why not try some asp component.
http://msdn.microsoft.com/en-us/library/windows/desktop/dd162617%28v=vs.85%29.aspx
You could potentially write a command line program that sits on a particular port, continuously checks for that locally and then use HTML5 WebSockets in IE to communicate with it?
i.e. C# PowerModeChangedEvent
SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(
SystemEvents_PowerModeChanged
);
I don't think so....
CPU cycles are paused when the client computer is put into Sleep mode. (win+L)
Start>Control Panel>Power
configures how the monitor(s) behave when the client is powered down or put to sleep mode.
the screen object in js returns the metic values (height/width) of the screen object but not its powered state.
the impact of wasted CPU cycles on a powered down secondary monitor should be un-noticable....
probably you have not selected the option to "Use software rendering instead of GPU rendering" on the Advance tab of internet options....
You will notice that your CPU on your desktop will throttle up and the cooling fan will race if you haven't set the above setting when running graphic intensive web pages or canvas scripts.
I've developed some Chrome apps and Chrome extensions these day for fun.
and I'm wondering if I can schedule launch Chrome app and run certain commands periodically like cron jobs.
I know Chrome provide "chrome.alarm api" to run a certain function periodically, but I believe it requires users to keep my chrome app open or to keep chrome browser open which my chrome extension is installed to.
Please tell me if I can do such a thing in the first of all, and if I can do, please tell me how I can accomplish that!
A Chrome App doesn't have to be running to use the chrome.alarms API. See https://developer.chrome.com/apps/alarms for details about how to use it.
Basically, here's how it works:
// background page (aka event page)
chrome.alarms.onAlarm.addListener(function() {
// Do something useful...
});
// Register an alarm that will wake my background page every hour.
chrome.alarms.create('', { periodInMinutes: 60 });
For info, here are some good Chrome App samples that use chrome.alarms at https://github.com/GoogleChrome/chrome-app-samples/search?utf8=%E2%9C%93&q=alarms
A Chrome Extension can stay active even before/after Chrome is launched, unless the user specifically forbids that. Kind of like Google Now operates in recent Chrome versions.
For that, you need to declare "background" permission.
Makes Chrome start up early and and shut down late, so that apps and extensions can have a longer life.
When any installed hosted app, packaged app, or extension has "background" permission, Chrome runs (invisibly) as soon as the user logs into their computer—before the user launches Chrome. The "background" permission also makes Chrome continue running (even after its last window is closed) until the user explicitly quits Chrome.
I'm afraid it's not an option for a Chrome App though. The wording in the documentation refers to deprecated legacy app types. See François's answer for a possible solution in Apps.
Is there a way to detect a wake from hibernation? I am developing an extension that displays information when the user turns on the computer and logs in to the system. I can do that easily by setting the extension to run when the system starts and execute the codes instantly.
background.js
function displayInfo(){ /*...*/ }
displayInfo();
However, some users might not turn off their computer, rather, they would hibernate for faster wake time. Hibernate should still be considered that the user is "turning on" the computer, but currently I have no way of detecting that.
Is there anyway I can achieve that?
No "perfect/foolproof" method, but some an idea:
Record the system time every 5 minutes or so. If the current time is much larger than the expected time, assume it slept/hibernated.
I am building a Time clock application for my employer to use with his employees. One of the requirements is to have it take a photo from a webcam every time a user clocks in and out of the system.
Thankfully this is possible using HTML5 and JavaScript and no longer requires Flash or Silverlight.
The problem however, is in this image below....
Since this application will be used on 1 PC and accessed by a large number of users everyday, this is a real problem for my application.
I hope there is a way to permanently authorize permission to use the camera for certain pages maybe or another alternative?
If your app is running from SSL (https://), this permission will be
persistent. That is, users won't have to grant/deny access every time.
http://www.html5rocks.com/en/tutorials/getusermedia/intro/#toc-security
Note, this only applies in Chrome. Each browser may implement the security prompts differently.