How do I get tcsetpgrp() to work in C?
Figured it out. I have to ignore any SIGTTOU signals. I did that by adding: signal(SIGTTOU, SIG_IGN); Before the tcsetpgrp() call.
Figured it out. I have to ignore any SIGTTOU signals. I did that by adding: signal(SIGTTOU, SIG_IGN); Before the tcsetpgrp() call.
The active window (the result of GetActiveWindow()) is the window attached to the calling thread that gets input. The foreground window (the result of of GetForegroundWindow()) is the window that’s currently getting input regardless of its relationship to the calling thread. The active window is essentially localized to your application; the foreground window is global … Read more
If you don’t have a handle to the window, use this before : [DllImport(“user32.dll”, SetLastError = true)] static extern IntPtr FindWindow(string lpClassName, string lpWindowName); Now assuming you have a handle to the application window : [DllImport(“user32.dll”, SetLastError = true)] static extern bool SetForegroundWindow(IntPtr hWnd); This will make the taskbar flash if another window has keyboard … Read more
public static boolean isServiceRunningInForeground(Context context, Class<?> serviceClass) { ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { if (serviceClass.getName().equals(service.service.getClassName())) { if (service.foreground) { return true; } } } return false; }
Basically, there is no such thing as a service type app or functionality in iOS. Even the “background” apps (UIBackgroundMode) cannot run entirely free and without restrictions like a service or daemon etc. on other OSs can. Here’s the situation regarding background execution and notifications and timers etc. 1) An app cannot execute in the … Read more
As a security feature of the Android platform, you cannot, under any circumstance, have a foregrounded service without also having a notification. This is because a foregrounded service consumes a heavier amount of resources and is subject to different scheduling constraints (i.e., it doesn’t get killed as quickly) than background services, and the user needs … Read more
Okey dokey. I’ve been through hell and back on this problem. Here’s how to proceed. There are bugs. This posting describes how to analyze bugs in the implementation and work around issues. Just to summarize, here’s how things are supposed to work. Running services will be routinely scavenged and terminated every 30 minutes or so. … Read more
From Google’s docs on Android 8.0 behavior changes: The system allows apps to call Context.startForegroundService() even while the app is in the background. However, the app must call that service’s startForeground() method within five seconds after the service is created. Solution: Call startForeground() in onCreate() for the Service which you use Context.startForegroundService() See also: Background … Read more
How to detect when an Android app goes to the background and come back to the foreground