I am working on tracking app where i get the location update in background mode from gps. I have search on google i found that Android 12 - Foreground service launch restrictions. So you have use Work manager insted of foreground intentService.
And workManager minimum limit is 15 minutues for WorkManager Periodicity. Then how can i get location update every seconds in background mode.
Because workmanager request not run every seconds.
Thank you.
When you are actively tracking the user you should use a Foreground Service. WorkManager is for cases where you care for the Work to finish, but the priority will be to save the battery.
I can assure you that WorkManager is the wrong API for you.
Why do you need to start the service from the background? What is your exact use case?
Check here:
https://developer.android.com/guide/background#replacing-foregound
Some use cases for using foreground services directly are as follows:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With