'Life cycle of foreground service started with setForegroundAsync
In the documentation of setForegroundAsync it says:
"This specifies that WorkRequest is long-running or otherwise important. In this case, WorkManager provides a signal to the operating system that the process should be kept alive, if possible, while this job is running."
But what happens if I run an addProximityAlert like this:
public Result doWork() {
setForegroundAsync(createForegroundInfo("Monitorando l'area"));
//...
lm.addProximityAlert(latitude, longitude, radius, -1, pendingIntent);
return Result.success();
}
Does the foreground service remain active forever? or, is the foreground service killed immediately after running addProximityAlert? if it ends immediately, how can I prevent it?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
