Open flamyoad opened 1 year ago
https://developer.android.com/about/versions/11/privacy/foreground-services
Android 11 changes when foreground services can access the device's location, camera, and microphone. This helps protect sensitive user data.
Camera and microphone foreground service types If your app targets Android 11 or higher and accesses the camera or microphone in a foreground service, you must include the camera and microphone foreground service types.
Restrictions to access while in use If your app starts a foreground service while running in the background, the foreground service cannot access the microphone or camera. Additionally, the service cannot access location unless your app has background location access.
Android 12
https://dontkillmyapp.com/
https://developer.android.com/training/scheduling/wakelock
(Foreground service + Wake Lock + Letting user whitelist your app seems the only solid option if your app targets Chinese market).
Need to acquire a wake lock if you want your service keep running after the screen is off.
But from my testing, 15min+ is still good on Samsung. However, Seems FGS alone is not enough to keep app alive in bg :)