我的服务是每个应用程序关闭时重新启动 [英] My service is restarted each time the application is closed

查看:178
本文介绍了我的服务是每个应用程序关闭时重新启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序有一个服务,按如下启动

I have a service in my app and start it as follows

Intent intent = new Intent(this, Prueba.class);
startService(intent);

另外,你的方法返回onStartCommand STAR_STICKY;

Also, your method return onStartCommand STAR_STICKY;

不过,我每次关闭应用程序重新启动该服务。至于服务不重新启动,继续运行?

However, every time I close the app the service is restarted. As for the service do not restarts and keep running?

推荐答案

请检查出来可能是这可能对您有用:

Please check it out may be this can be useful for you:

http://developer.android.com/reference/android/app/Service.html#ServiceLifecycle

这篇关于我的服务是每个应用程序关闭时重新启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆