Android Foreground Service

Asked 2 years ago, Updated 2 years ago, 132 views

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

2022-09-30 21:49

1 Answers

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.


2022-09-30 21:49

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.