This is big red flag in apps as it can lead to some real privacy concerns and a lot of questions from iOS and Android app store reviewers.
IF you need to do some background services, there is the background task API from capacitor.
https://capacitor.ionicframework.com/docs/apis/background-task