Reputation: 611
is Calling startForeGround mandatory to make a service background service? When I start a service and return START_STICKY on onstartCommand function,it will start again after service kill.(example close app with swiping) I could not understand functionality of startForeGround function.returning START_STICKY is not enough?
Upvotes: 0
Views: 71
Reputation: 1335
startForeGround
is no needed if you are going to run a background service
, this method is useful when you you want to run a foreground service
which probably will show a Notification while it is running. This is a nice way to make a service run for a long time even if the user killed(closed) the app.
Upvotes: 1