I am currently working on an app for privte use which tracks an api for me.
I want that api to be checked every 20 / 60 seconds based on wifi or mobile data,
The Issue with this is that theres ForegroundService Timeouts that so far I havent found a way to bypass.
The app can ask for any permissions that are possible. I dont have to worry about things like it not being uploadable to playstore etc.
I currently try to start them with
var fgType = ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC | ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE | ServiceInfo.FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED
startForeground(NOTIF_ID, notification, fgType)
I have the manifest permissions for exact alarm for both use and schedule.