谢谢各位,找到问题了,
是在用INTENT启动service的时候
官方文档说 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.
某个时候方法onStart()已经deprecated,在Android 2.0之后被onStartCommand所取代。onStartCommand为了backwards compatibility,默认实现是去call onStart方法,并且会在最后返回START_STICKY or START_STICKY_COMPATIBILIT
要加入对intent空指针的保护
#9
...我倒觉得问题在于你为什么会传递NULL的Intent引用,不要加个判断就把真正的问题掩盖了
#10
看logcat在log,一般里面都会报exception.
#11
This may be null if the service is being restarted after its process has gone away
谢谢各位,找到问题了,
是在用INTENT启动service的时候
官方文档说 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.
某个时候方法onStart()已经deprecated,在Android 2.0之后被onStartCommand所取代。onStartCommand为了backwards compatibility,默认实现是去call onStart方法,并且会在最后返回START_STICKY or START_STICKY_COMPATIBILIT
要加入对intent空指针的保护
#9
谢谢各位,找到问题了,
是在用INTENT启动service的时候
官方文档说 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 ……
...我倒觉得问题在于你为什么会传递NULL的Intent引用,不要加个判断就把真正的问题掩盖了
#10
看logcat在log,一般里面都会报exception.
#11
引用 8 楼 RomanticRabbit 的回复:
谢谢各位,找到问题了,
是在用INTENT启动service的时候
官方文档说 The Intent supplied to startService(Intent), as given. This may be null if the service is being restarted after its process has ……
This may be null if the service is being restarted after its process has gone away
引用 8 楼 RomanticRabbit 的回复:
谢谢各位,找到问题了,
是在用INTENT启动service的时候
官方文档说 The Intent supplied to startService(Intent), as given. This may be null if the service is being restarted after its process has ……
This may be null if the service is being restarted after its process has gone away