Windows 10 移动应用程序后台任务或服务在 phone 重新启动时自动启动

Windows 10 Mobile App background task or service auto start when phone restarts

我正在编写 Windows 10 移动应用程序 (c#);这是一个 notification/alarm 应用程序;我想知道我是否可以 运行 可以触发警报或通知的后台服务或任务或调度程序。我正在寻找类似于 windows 服务的东西,因此即使我的 phone 重新启动,该服务或后台任务也会自动持续地启动 运行 并向用户显示通知。我已经创建了 windows 10 运行 次(后台任务),但是当我重新启动 phone 时它们停止了。如何自动启动后台任务或 windows 移动服务。 (这是一个 windows 10 的移动应用程序)。

I have created windows 10 runtime (background task) but they stop when I restart my phone.

由于您的后台任务是为了触发警报或通知,理论上来说,您的后台任务不应该在您重启phone时停止。注册后台任务后,您的后台任务将一直运行,直到您注销它或用户将其关闭,除非有 resource constraints 可以强制您的后台任务停止。

根据你的描述,你可以试试Periodic notification,重启设备应该也不会影响这个通知。

How to automatically start a background task or windows mobile service. (It’s a windows 10 mobile app).

我不知道是什么原因导致您的设备重启后后台任务停止,但大多数后台任务可以由系统自动启动。通过移动服务,我不太清楚你指的是什么,如果是像Azure这样的应用服务,你可以使用Push notifications,如果是本地应用服务,我个人认为这不太适合你设想。