Hello,
How can we get locations for both android & iOS when app is suspended?
This is a keep-alive issue for background services. In this case, the system-level memory reclamation mechanism may reclaim the program's memory while the program is in the background. Because the program's memory is cleared, it cannot continue to run to obtain data.
Therefore, if you need the program to keep running in the background, you can use some keep-alive mechanism.
For iOS, Apple officially provides a background running solution for location services, please refer to Configuring your app to use location services and iOS Backgrounding with Tasks.
For Android, you can use Foreground Service with higher priority to perform location services to avoid memory being recycled when running in the background.
Since this feature is native to the Android platform, its implementation is no different from what is noted in the Xamarin documentation.
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.