问题标签 [backgrounding]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
android - Google 地图如何在不使用前台服务的情况下知道我的位置?
我一直在开发一个从可穿戴设备(通过蓝牙连接)收集数据的应用程序。即使应用程序的主要活动被 Android 框架破坏,我也希望存储这些数据。经过一番研究,我注意到我必须使用前台服务才能做到这一点。
然后,我注意到谷歌地图向我发送了关于我的位置的通知(例如,麦当劳怎么样,查看它),这意味着即使应用程序的主要活动尚未启动,该应用程序也会将我的位置与谷歌的服务器通信。
他们如何在不使用前台服务的情况下实现这种行为?
android - Store (or send) data from Bluetooth device when app is in background
I'm developing an Android app that reads data from a Bluetooth device and saves it to disk (and perhaps send some data to a server). The Bluetooth device is a wearable with a heart rate sensor and a bunch of other sensors. It sends data to the Android app every second or so.
The app works fine when in foreground, but when in background, it gets killed after a few minutes (usually 15 to 30 min).
I understand the concepts of foreground and background services and it seems like what I need here is a foreground service (correct me if I'm wrong) to make sure the process doesn't get killed. It's a pain however because I'll have to move most of my app's classes in remote objects in the foreground service classes.
However! I noticed that just creating a simple foreground service and binding my main activity to it makes it so that the activity doesn't get killed as fast, as a matter of fact I tested it for an hour and a half and everything was still running smoothly in the main activity process.
Could that just be the solution I'm looking for? Or do I really have to move most of my classes in remote objects in a more complex foreground service?
loops - 如何在 Xamarin.forms 中创建循环后台服务
我想创建一个后台服务,总是在 Xamarin.Forms 中运行和循环一个函数,尤其是在 Android 中,我尝试了带有计时器和 Intent 服务的服务,但没有工作。请帮我 :(
xamarin.ios - 在后台时从 Xamarin iOS 提交数据
在我们当前的 Xamarin 项目中,我遇到了一个奇怪的问题。当应用程序向服务器发送更大的数据块时,为了在应用程序进入后台时保护它,我们正在启动一个长时间运行的任务(使用UIApplication.SharedApplication.BeginBackgroundTask / UIApplication.SharedApplication.EndBackgroundTask
API)。奇怪的是,当我从我的机器上构建和运行时,这很有效,但是当我的几个同事在从他们的机器上构建/部署应用程序时运行完全相同的场景时,会出现超时错误。
据我了解,在这样的长期运行任务中运行东西应该可以工作。我不应该在info.plist中指定后台功能。此外,作为发送/接收的HttpClient
雇员NSUrlSession
,当应用程序进入后台时,应该保护它免受中断,对吧?
我无法弄清楚为什么相同的代码在使用不同的 Mac 构建时会在同一设备上产生不同的行为。VS 中的某个地方是否可能存在一些影响这种行为的机器本地设置?
我现在没有想法,所以任何提示将不胜感激。
这是根据构建/部署它的 Mac 工作/失败的代码示例:
c# - 即使应用程序关闭,Xamarin 也会为数据同步形成后台服务
我想创建一个在后台运行的服务,即使我的应用程序关闭以进行 Sqlite 和 mysql 的数据同步。
我尝试了一些方法,但无法实现我的目标。
如果有人可以给我一个示例应用程序,即使应用程序关闭,它也会在后台运行服务
谢谢
c# - Xamarin 消息中心多个相同的消息不同的结果
我正在制作一个计时器应用程序,所以后台非常重要。我这样做的方式是通过此链接中概述的这种方法。 https://robgibbens.com/backgrounding-with-xamarin-forms/基本上是一个 Ticked 消息循环和更新视图。
问题是我想同时运行多个计时器。这使我的程序感到困惑,并且计时器开始接收彼此的消息。知道如何在一个类与 AppDelegate.cs 和 MainActivity.cs 类之间的消息中心私下发送消息吗?
谢谢
c# - Xamarin iOS 后台应用程序终止
我目前正在为 android 和 iOS 开发一个计时器应用程序。暂时我真的更关心iOS,即使在遵循Xamarin关于后台的文档,使用消息中心调用appDelegate.cs类,然后使用平台特定代码启动后台任务之后,我仍然让我的应用程序终止.
有什么方法可以将 iOS 应用程序作为前台服务,例如在 android 上。还是后台服务仍然可行?我试图让用户提前 23 小时设置一个计时器并显示倒计时。
linux - 为什么我看到 Bash 中后台进程的速度收益递减?
我试图弄清楚为什么在后台处理 Bash 脚本中的许多进程时,我会看到速度回报递减。就像是:
它从大门尖叫到 10,000、20,0000 ......但随后它开始放慢它可以在 70,000... 80,0000 左右建立后台进程的速度。例如,计数打印到屏幕的速度会减慢一个看似线性的量,具体取决于总数。
机器运行基本上立即完成的后台作业的速率不应该是一致的,而不管添加和关闭了多少?