Service的onStartCommand中intent null point的问题
2014-11-13 16:28
429 查看
开始的时候很纳闷,为什么会这样了,然后就搜索了下,发现其实文档早就告诉我了,只不过英文差,没看仔细。。。
原文如下:
http://developer.android.com/reference/android/app/Service.html#START_STICKY
相信大家都是知道onStartCommand是有返回值的,这货真心是有用的,为的是告诉系统这后台服务要怎么存活着,其实英文不好的也可以慢慢看的,看着看着就懂了
本人遇到的问题,简单翻译过来就是,系统会重启app的服务,重启的时候intent就是空的,自己要做好判断。。。
原文如下:
int | START_NOT_STICKY | Constant to return from onStartCommand(Intent, int, int): if this service's process is killed while it is started (after returning from onStartCommand(Intent, int, int)), and there are no new start intents to deliver to it, then take the service out of the started state and don't recreate until a future explicit call to Context.startService(Intent). |
相信大家都是知道onStartCommand是有返回值的,这货真心是有用的,为的是告诉系统这后台服务要怎么存活着,其实英文不好的也可以慢慢看的,看着看着就懂了
本人遇到的问题,简单翻译过来就是,系统会重启app的服务,重启的时候intent就是空的,自己要做好判断。。。
相关文章推荐
- android中service的onStartCommand()方法中intent为null的问题
- Android中service的onStartCommand()方法中intent为null的问题
- 我的Android进阶之旅------>android中service的onStartCommand()方法中intent为null的问题
- android Service onStartCommand intent为nullhttp://hold-on.iteye.com/blog/2024926
- Service中onStartCommand方法intent报空的问题
- Service onStartCommand各种返回详解,解决问题:只调用onCreate不调用onStartCommand
- 【android】在Service的onStartCommand()中调用stopself()应该注意的问题
- Service onStartCommand各种返回详解,解决问题:只调用onCreate不调用onStartCommand
- Service onStartCommand返回值问题
- Service的onStartCommand中报空指针问题
- Service 的 onStartCommand()方法的返回值问题
- Service onStartCommand各种返回详解,解决问题:只调用onCreate不调用onStartCommand
- Android中Service的onStartCommand使用和遇到的问题
- Service中onStartCommand的返回值问题
- Service onStartCommand返回值问题
- Service 的 onStartCommand(Intent, int, int) 返回值
- 【android】在Service的onStartCommand()中调用stopself()应该注意的问题
- service的onStartCommand方法
- 【起航计划 033】2015 起航计划 Android APIDemo的魔鬼步伐 32 App->Service->Foreground Service Controller service使用,共享service,前台服务,onStartCommand
- Android Service生命周期 Service里面的onStartCommand()方法详解