Points to Keep in Mind for onStartCommand()
:
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)
Returns.
- 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
So you need to return START_STICKY, or one of the values from Click Here
本文转载自:http://stackoverflow.com/questions/19584969/activity-manager-crash