background-process

Receiving broadcast from notification on Android Oreo

戏子无情 提交于 2019-11-30 22:49:37
问题 I have a custom button in a sticky notification. I used to attach a PendingIntent to it for receiving button clicks: Intent intent = new Intent(); intent.setAction("com.example.app.intent.action.BUTTON_CLICK"); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 2000, intent, PendingIntent.FLAG_UPDATE_CURRENT); contentViewExpanded.setOnClickPendingIntent(R.id.button, pendingIntent); When i run this code on Oreo , i get BroadcastQueue: Background execution not allowed in logcat

Android keep BroadcastReceiver in background

南楼画角 提交于 2019-11-30 22:00:17
I created a BroadcastReceiver and it runs only when my app shown in recent apps menu. If I remove my app from the recent apps the BroadcastReceiver will stop working. How can I keep the BroadcastReceiver in background? I register the BroadcastReceiver from my main activity (in OnCreate()). IntentFilter intentFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); registerReceiver(receiver, intentFilter); BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { } }; This is not how you should register a receiver. You receiver

CoreBluetooth repeatedly disconnecting

删除回忆录丶 提交于 2019-11-30 20:01:31
I've looked up and down for this problem, but no one seems to have it. I have two iPads. One is acting as a Bluetooth peripheral that is always in the foreground. Since I am more interested in the central side, I have made my central iPad background-capable for BLE-central. My workflow is as follows: Central app runs and starts scanning Peripheral advertises service (or comes within range) Central device connects to peripheral and stops scanning Peripheral stops advertisement (or leaves range) Central device disconnects and starts scanning Do steps 1-5 seamlessly whether the central is in the

Background fetch is not working after killing the app

蓝咒 提交于 2019-11-30 18:38:36
I'm trying to get data from url with background fetch. My func tries to get data and if there is a new data, it sends local notification. Background fetch works after about 10 - 20 minutes when i minimize the app. But when i kill the app (double click home button and close app) it doesn't work. I waited about 1 hour but it didn't work. I am using background service in android and it is working successfully. Is there any way to get data from url and send local notification when app is closed? I am using Xcode 6 and swift 1.2 Alex The Background Fetching will NOT happen in your app after the

Android keep BroadcastReceiver in background

夙愿已清 提交于 2019-11-30 17:18:44
问题 I created a BroadcastReceiver and it runs only when my app shown in recent apps menu. If I remove my app from the recent apps the BroadcastReceiver will stop working. How can I keep the BroadcastReceiver in background? I register the BroadcastReceiver from my main activity (in OnCreate()). IntentFilter intentFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); registerReceiver(receiver, intentFilter); BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive

Perform task on background thread in iOS, keep execution running even when the application enters background: [closed]

♀尐吖头ヾ 提交于 2019-11-30 15:17:46
How to perform execution on a background thread? Execution should continue in the background even if the user presses the home button. Add these properties to your .h file @property (nonatomic, strong) NSTimer *updateTimer; @property (nonatomic) UIBackgroundTaskIdentifier backgroundTask; Now suppose you have a action on button --> btnStartClicked then your method would be like : -(IBAction)btnStartClicked:(UIButton *)sender { self.updateTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(calculateNextNumber) userInfo:nil repeats:YES]; self.backgroundTask = [

Continue countdown timer when app is running in background/suspended

て烟熏妆下的殇ゞ 提交于 2019-11-30 14:20:40
问题 I have a functional countdown timer. The problem is that I need to continue the countdown when the user puts the app in the background. Or suspends the app? I am not sure what the correct terminology is to describe this action. In other words, the user opens the app and starts the countdown. The user should be able to use other apps but the countdown still operate. Also, the countdown should be able to run forever until it finishes or when the user terminates running the app. Here is the code

Capturing the PID of a background process started by a Makefile

▼魔方 西西 提交于 2019-11-30 14:04:54
I have a Makefile that starts a Django web server. I would like the server to be started in the background, with the PID saved to a file. My recipe looks like this: run: venv @"${PYTHON}" "${APP}/manage.py" runserver 80 Intuitively, to background the process and capture the PID, I'd have to do something like this: run: venv @"${PYTHON}" "${APP}/manage.py" runserver 80 & ; echo "$$!" > "${LOGDIR}/django.pid" This doesn't work, though. The sub-shell that 'make' uses (/bin/sh in my case) works when you use: <command> & ...to background a process, and works when use: <command> ; <command> (or

AFNetworking background file upload

送分小仙女□ 提交于 2019-11-30 13:43:53
I want to upload files to my server from my app. The code below is working great when app is active. If I press home button or open another app uploading stops. I activated background fetch but still not working. Afnetworking has background support but I cant figure out how I implement this feature to my code. NSString *str=[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Archive.zip"]; NSDictionary *parameters = @{@"foo": @"bar"}; NSURL *filePath = [NSURL fileURLWithPath:str]; AFHTTPRequestSerializer *serializer = [AFHTTPRequestSerializer serializer]; NSData *imageData=

HttpClient GetAsync fails in background task on Windows 8

白昼怎懂夜的黑 提交于 2019-11-30 13:02:39
I have a Win RT app that has a background task responsible for calling an API to retrieve data it needs to update itself. However, I've run into a problem; the request to call the API works perfectly when run outside of the background task. Inside of the background task, it fails, and also hides any exception that could help point to the problem. I tracked this problem through the debugger to track the problem point, and verified that the execution stops on GetAsync. (The URL I'm passing is valid, and the URL responds in less than a second) var client = new HttpClient("http://www.some-base-url