onStartCommand

open fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int

The new 2.0 startup code.

Return

The return value indicates what semantics the system should use for the service's current started state. It may be one of the constants associated with the START_CONTINUATION_MASK bits.

Parameters

intent

The Intent supplied to startService(Intent), as given. This may be null if the service is being restarted after its process has gone away, and it had previously returned anything except START_STICKY_COMPATIBILITY.

flags

Additional data about this start request. Currently either 0, START_FLAG_REDELIVERY, or START_FLAG_RETRY.

startId

A unique integer representing this specific request to start. Use with stopSelfResult(int).

See also

android.app.Service#onStartCommand(android.content.Intent, int, int)