'I must foreground service when receives location information only once in android 10 and above?

* hi, i want receive update user location and show in text view only once and remove update location when it received.
i must use foreground service for that ?
sorry for bad writting. *

hello friends, i want receive update user location and show in text view only once and remove update location when it received. i must use foreground service for that ? sorry for bad writting.



Solution 1:[1]

No.

The document is saying that if you need to continuously get user's location, then you need that foreground service. In your case, you do not need that service, because you need to get user's location only once.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1