Is there any way in Java where if I run my Java app in background and whenever I click on some App, I can get the name of it.
This Java program should run in background without the knowledge of the user and will send the app name to a remote server.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I wrote a time-tracker app that does something similar back in the day, to track how I was spending time on various projects/applications, etc. The idea was to track my application usage locally, and use a POST request to a web server for centralized logging. I could also run this app on any machine I wanted, and the POST request would still go back to a central server, so I could track my own activity across multiple machines.
One thing you could use is JNI to bind to the Win32 API, which can then give you access to Window titles, process information, etc.
This Q/A should get you started:
How can I read the window title with JNI or JNA?
Somewhere (I can’t find it right now) there’s a
.JARon the net that wraps the win32 API, making this sort of functionality very simple to do in Java.