background-process

Cant run background service

烂漫一生 提交于 2019-12-02 22:47:32
问题 I am trying to use LocationListener class in a background service to receive the current location of user every time and then comparing it with some data stored in my database. but I am gettin error, when I am trying to do that package com.example.alert; import android.app.Service; import android.content.Context; import android.content.Intent; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.media.MediaPlayer;

How to run a Background Task on iOS application when Internet connection is detected?

妖精的绣舞 提交于 2019-12-02 22:42:52
问题 I'm using a third party library "Reachability.swift" https://github.com/ashleymills/Reachability.swift Followed this blog post to identify network event using Notification Center, So the change in network event can be identified dynamically in the foreground https://blog.pusher.com/handling-internet-connection-reachability-swift/ My Requirement:- I need to run a background service that uses Alamofire (Information not needed for alamofire) to push the locally saved SQLite data to the server

Start-transcript in a background process

丶灬走出姿态 提交于 2019-12-02 22:15:36
问题 is there a way to handle start-transcript in a background process? I have a script launched in background. almost everything works fine, except logging with start-transcript? in fact, it creates my $filelog.txt but doesn't write anything in it? 回答1: You cannot do it, non-interactive PowerShell hosts (in your case background job) don't support host output Cmdlets like Start-Transcript, Write-Host etc. You'd have to use you own logging functions or output messages to file via Out-File for

php process background

試著忘記壹切 提交于 2019-12-02 20:51:04
问题 I've a question about this answer php execute a background process Can anyone provide me a working simple example to try what the answer explains? Thanks in advance! Alberto 回答1: On linux box only: result.php <?php $cmd = 'for i in {1..5}; do date; sleep 2; done'; $outputfile = '/tmp/result.txt'; $pidfile = '/tmp/result.pid'; exec(sprintf("%s > %s 2>&1 & echo $! >> %s", $cmd, $outputfile, $pidfile)); ?> in command line: php result.php; tail /tmp/result.txt; /* to monitor the results, take 10

php background process using exec function

女生的网名这么多〃 提交于 2019-12-02 20:38:59
I have searched a lot to find the exact answer but didn't find any. many people mentioned that we should & at end of command to don't wait for response. for example to run bg.php in background , this was recommended: exec("/usr/bin/php bg.php &"); but it doesn't work for me. and the main script waits for complete execution of the bg.php . I also read somewhere to write bg.php output in a logfile but my background script doesn't produce any output. It does some process and then write something in database. I just want my script to run bg.php and don't wait for it to end. please help me

android notification in background if app closed?

风流意气都作罢 提交于 2019-12-02 20:34:55
I am trying to display a notification in the Android notifications bar even if my application is closed. I've tried searching, but I have had no luck finding help. An example of this is a news application. Even if the phone screen is off or the news application is closed, it can still send a notification for recent news and have it appear in the notification bar. How might I go about doing this in my own application? Idipaolo You have to build a Service that handles your news and shows notifications when it knows that are new news ( Service Doc ). The service will run in background even if

iOS 7 Background Fetch When the App is Not Running

不问归期 提交于 2019-12-02 19:44:26
I've written a simple application in order to test and monitor how the background fetch feature works in iOS7. First of all, I've set UIBackgroundMode options in my Info.plist file. Then; I added to below code into application:didFinishLaunchingWithOptions: method in AppDelegate.m : At last, I've implemented the application:(UIApplication *)application performFetchWithCompletionHandler: method as requested. Every time I click Debug->Simulate Background Fetch button, it changes the application's batch number and works as expected. However, I've never been able to make it work when the

How to get gps location once for 5 mins android?

回眸只為那壹抹淺笑 提交于 2019-12-02 18:37:51
hi there can anybody give me a sample code for get location for every five minutes please i have tried and i can get location once by cliking on button, but i need it to be displayed once for five minutes. thank you this is my code : public void checkLocation(View v) { //initialize location manager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); //check if GPS is enabled //if not, notify user with a toast if (!manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { Toast.makeText(this, "GPS is disabled.", Toast.LENGTH_SHORT).show(); } else { //get a location provider

How to implement background processing for ASP.Net MVC website in a shared hosting environment?

て烟熏妆下的殇ゞ 提交于 2019-12-02 18:24:22
I am developing my first web application using ASP.Net MVC, and I am in a situation where I would like a background service to process status notifications outside of the application, not unlike the reputation/badge system on stackoverflow. What is the best way to handle something like this? Is it even possible in a shared-hosting environment like Godaddy, which I am using. I don't need to communicate with the background worker directly, since I will be adding notification records to a database table with a column set to an "unprocessed" state. Then the worker will just scan the table on a

Best way to send HTTP GET requests ansynchronously in Android?

删除回忆录丶 提交于 2019-12-02 17:17:54
In an Android app, I have to make multiple GET requests to a URL in order to transmit data to an external server (that's how the third party API works). Data comes in sporadically. I store this data in a queue and want to send it to the server in a background asynchronously without slowing down the main UI thread. Each unit of data in the queue requires a GET request. The queue has to be emptied even if the app closes. What's the best practice to do this? Please post/direct me to code/tutorials. What's the best practice to do this? That would depend on what "this" is and where this work is