background-process

Need code example on how to run an Android service forever in the background even when device sleeping, like Whatsapp?

醉酒当歌 提交于 2019-11-26 11:56:33
问题 I have tried various ways to achieve this, but my service eventually gets killed. I want to use AlarmManager to trigger a class every one hour. Even if the device is sleeping, it should sent a flashing LED alert, vibration or sound. In any case, it should run forever. I have noticed that Whatsapp is always running, even though I kill all the running apps and clear the memory, put the device to sleep, and still Whatsapp receive messages and alerts me. How are they doing it? I want to do the

Is there any way to run service continuously in android?

佐手、 提交于 2019-11-26 11:24:52
问题 There are few questions similar to this on StackOverFlow but none of the solutions are working for me Problem The problem is with only few devices like OnePlus and MI ,The service is getting killed as soon as the user swipes away app from recent app. I read that these OEM\'S use some aggressive strategies to kill services . I just want to know is there any way to keep service running or start it as soon as it gets killed . What I want I need to run a service which will give location

Run background process in Python and do NOT wait

拟墨画扇 提交于 2019-11-26 11:23:03
问题 My goal is simple: kick off rsync and DO NOT WAIT. Python 2.7.9 on Debian Sample code: rsync_cmd = \"/usr/bin/rsync -a -e \'ssh -i /home/myuser/.ssh/id_rsa\' {0}@{1}:\'{2}\' {3}\".format(remote_user, remote_server, file1, file1) rsync_cmd2 = \"/usr/bin/rsync -a -e \'ssh -i /home/myuser/.ssh/id_rsa\' {0}@{1}:\'{2}\' {3} &\".format(remote_user, remote_server, file1, file1) rsync_path = \"/usr/bin/rsync\" rsync_args = shlex.split(\"-a -e \'ssh -i /home/mysuser/.ssh/id_rsa\' {0}@{1}:\'{2}\' {3}\"

Background timer task in JSP/Servlet web application [duplicate]

牧云@^-^@ 提交于 2019-11-26 10:31:12
This question already has an answer here: How to run a background task in a servlet based web application? 5 answers I want to retrieve from subscription and store feeds to DB from subscription after every 6 hours. I want to have a timer thread in background to accomplish this task. What's the best way? A normal timer thread or Quartz API? BalusC To start, I wouldn't use JSP for this. There it is not for. When you're on Java EE 5, use the container-provided jobscheduling APIs for this. Further detail depends on the container you're using. JBoss AS 5 for example ships with Quartz out the box.

Can I use threads to carry out long-running jobs on IIS?

心不动则不痛 提交于 2019-11-26 10:15:27
In an ASP.Net application, the user clicks a button on the webpage and this then instantiates an object on the server through the event handler and calls a method on the object. The method goes off to an external system to do stuff and this could take a while. So, what I would like to do is run that method call in another thread so I can return control to the user with "Your request has been submitted". I am reasonably happy to do this as fire-and-forget, though it would be even nicer if the user could keep polling the object for status. What I don't know is if IIS allows my thread to keep

How to get PID of background process?

你。 提交于 2019-11-26 09:45:53
I start a background process from my shell script, and I would like to kill this process when my script finishes. How to get the PID of this process from my shell script? As far as I can see variable $! contains the PID of the current script, not the background process. You need to save the PID of the background process at the time you start it: foo & FOO_PID=$! # do other stuff kill $FOO_PID You cannot use job control, since that is an interactive feature and tied to a controlling terminal. A script will not necessarily have a terminal attached at all so job control will not necessarily be

Spawn a background process in Ruby

寵の児 提交于 2019-11-26 09:35:24
问题 I\'m writing a ruby bootstrapping script for a school project, and part of this bootstrapping process is to start a couple of background processes (which are written and function properly). What I\'d like to do is something along the lines of: `/path/to/daemon1 &` `/path/to/daemon2 &` `/path/to/daemon3 &` However, that blocks on the first call to execute daemon1. I\'ve seen references to a Process.spawn method, but that seems to be a 1.9+ feature, and I\'m limited to Ruby 1.8. I\'ve also

How to use beginBackgroundTaskWithExpirationHandler for already running task in iOS

混江龙づ霸主 提交于 2019-11-26 09:06:52
问题 In my app, I am uploading images to server from iPhone. While sync if user press home button, App will close. I want app must be running in background till sync finish. My question is: How can I add currently running task with \" beginBackgroundTaskWithExpirationHandler \"? Please share your ideas. 回答1: Despite its name, beginBackgroundTaskWithExpirationHandler: does not actually "begin" a task. It might be better thought of as "register..." rather than "begin...." You're just telling the

iOS Voip Socket will not run in background

非 Y 不嫁゛ 提交于 2019-11-26 08:48:02
问题 I am getting a VOIP socket to run in the background in an iOS application. My connection works fine, but it won\'t wake up when my app goes into the background. If I open the app back up, though, it responds to any messages it got while it was asleep. I set up my stream like this: CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault, (CFStringRef) @\"test.iusealocaltestserver.com\", 5060, &myReadStream, &myWriteStream); CFReadStreamSetProperty ( myReadStream, kCFStreamNetworkServiceType,

PHP exec() as Background Process (Windows Wampserver Environment)

ぐ巨炮叔叔 提交于 2019-11-26 06:27:44
问题 I\'m trying to setup a php trigger file that will set off a background process. (see this question) I\'m doing this on a Windows Wampserver environment. So for example I have trigger.php that runs the exec function that calls for my backgroundProcess.php to be parsed and executed. However the problem is that my trigger.php file is waiting for the exec() command to finish running backgroundProcess.php before it stops. The background process runs for about 20-30 seconds, and trigger.php is