如果我的应用程序被杀死,则为Android后台任务

问题描述 投票:0回答:1

我的任务是,在Android设备中发生事件之前/之后发送通知。我尝试使用AlarmManager,Worker,JobScheduler,但是当用户杀死我的应用程序时,这些后台任务都无法正常工作。有没有一种方法可以在Android中完成此简单任务?

thx扎梅克

android background android-alarms worker android-jobscheduler
1个回答
0
投票

即使应用程序退出,也应使用WorkManager来确保执行。

Introduction to work manager

Official documentation

Useful Codelab to grasp the concept

© www.soinside.com 2019 - 2024. All rights reserved.