As for the foreground service, I think I have to call startForeground within 5 seconds to notify the user. On the other hand, can I use the foreground service without user notification for 5 seconds?
android
Nice to meet you.
The service started with startForegroundService must be called startForeground service with notification as described.StartForeground must be called within 5 seconds of service startup before ANR (= application outage).
I think your question is whether the service can be started for 5 seconds without calling it.
If you do not invoke startForeground, the application will remain ANR (=no application response) even if the service is terminated.So I don't think I can use it in real life.
© 2024 OneMinuteCode. All rights reserved.