background-task

Why does logging backgroundTimeRemaining show a wrong/big number even though app was moved to background?

≯℡__Kan透↙ 提交于 2019-12-08 06:40:17
问题 I'm logging my UIApplication.shared.backgroundTimeRemaining but the number is huge. It's almost 200 digits. This is how I'm logging it. os_log("Lat: %f | Long: %f | RemainingTime: %f ", log: log, type: .default, location.coordinate.latitude, location.coordinate.longitude, UIApplication.shared.backgroundTimeRemaining) I thought there is something wrong with the format of my logging so I also tried placing a breakpoint and printing it but still the number that it logs is the same huge number. I

Running Background Audio in different pages of UWP App

喜欢而已 提交于 2019-12-08 06:33:31
问题 I am making a UWP App where I run Background Audio in the MainPage on a Button Click event. When I move to another page, there's also a different Media to play in Background Audio Task there. How can I stop the currently playing Task to run the other? Should I define something globally? Any help regarding this issue? Edit I am using this sample: https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/BackgroundAudio While the backgroundAudio of the first Page is running, I

UWP: Why can I exceed the CPU quota with my background task (using TimeTrigger)?

…衆ロ難τιáo~ 提交于 2019-12-08 05:34:05
问题 In my UWP app I have a background task, triggered by a TimeTrigger. In the code of the background task I have this snippet ("first activity" and "second activity" in my example consume hardly any resources): var deferral = args.TaskInstance.GetDeferral(); await Task.Run(async () => { //... first activity await Task.Delay(TimeSpan.FromSeconds(90.0)); //... second activity, 90 seconds later }); So my questions are: Why does the above code work, as the documentation clearly says "Background

BackgroundTaskRegistration trigger property is null

僤鯓⒐⒋嵵緔 提交于 2019-12-08 04:36:23
问题 Hi want to receive push notifications on background task for that i have created Portable library here is my Background task class using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; using Windows.ApplicationModel.Background; using Windows.Data.Xml.Dom; using Windows.Networking.PushNotifications; using Windows.Storage; using Windows.UI.Notifications; namespace BackgroundTask {

Register a Background Task without running the app

早过忘川 提交于 2019-12-07 19:18:27
问题 tl;dr : How do I register a Background Task without having to run the app? Long version : I want to register a Background Task to run every time the user logs in using SystemTriggerType.UserPresent . I've found information about registering the Task, but that is code that has to be executed. That would be fine if the Task only has to be executed after the app runs. But how do I register the Task without running the app? A Background Task can be registered by var builder = new

Windows Phone 8.1 background task closes before completion

妖精的绣舞 提交于 2019-12-07 08:10:35
问题 My background task takes a long time to complete, and the OS is just killing it. I'm trying to sync my contacts online, here's what I'm doing: Get all contacts from phonebook (takes ~1 second) Upload them to a server (~2 seconds) Retrieve all contacts from server (~2-3 seconds) Delete all contacts from ContactStore(ContactStore.DeleteAsync sometimes takes 1 minute to complete) Create a ContactStore and import all contacts )(~1-2 minutes for 1000 contacts) I have ~100 contacts and it's working

Why does logging backgroundTimeRemaining show a wrong/big number even though app was moved to background?

被刻印的时光 ゝ 提交于 2019-12-07 06:11:24
I'm logging my UIApplication.shared.backgroundTimeRemaining but the number is huge. It's almost 200 digits. This is how I'm logging it. os_log("Lat: %f | Long: %f | RemainingTime: %f ", log: log, type: .default, location.coordinate.latitude, location.coordinate.longitude, UIApplication.shared.backgroundTimeRemaining) I thought there is something wrong with the format of my logging so I also tried placing a breakpoint and printing it but still the number that it logs is the same huge number. I also looked into this question which has a fair explanation, that is if your app is in foreground then

can't start beginBackgroundTask swift 3

牧云@^-^@ 提交于 2019-12-07 04:03:00
问题 Sorry I am stuck, but I am trying to start background task (XCode8, swift 3) Example from here: https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html#//apple_ref/doc/uid/TP40007072-CH4-SW3 In AppDelegate.swift: func applicationDidEnterBackground(_ application: UIApplication) { var bgTask: UIBackgroundTaskIdentifier = 0; bgTask = application.beginBackgroundTask(withName:"MyBackgroundTask",

Count while in background (NSTimer for more than 3 mins)

半腔热情 提交于 2019-12-06 19:47:25
Is there any way to run NSTimer for more than 3 mins in background? I have to create simple app that uses `locationManager(manager: CLLocationManager, didRangeBeacons beacons: [CLBeacon], inRegion region: CLBeaconRegion)` for scan my beacons. I have run into problem when I needed to check if user is exactly 10 seconds near closest beacon. I created var timer: NSTimer? var lastClosestBeacon: CLBeacon? { didSet { timer?.invalidate() timer = NSTimer.scheduledTimerWithTimeInterval(10, target: self, selector: "showLocalNotification", userInfo: nil, repeats: false) // NSRunLoop.mainRunLoop()

Native images generated against multiple versions of assembly System.Net.Http

混江龙づ霸主 提交于 2019-12-06 02:52:33
I have Windows Phone Silverlight 8.1 application which is using BackgroundTask project for WNS and timer tasks. I`m getting following error on calling some method from BackgroundTask project: ERROR: Native images generated against multiple versions of assembly System.Net.Http. Does anyone have some idea where can be problem? I found a problem: I have Windows Phone Silverlight 8.1 main project (converted from WP8 for IBackgroundTask support) referenced to DAL project (WP Silverlight 8.1). Also I have a background task project (WP8.1) referenced to DAL project (WP 8.1). Both DAL projects