开发者

Service stopping another Service

i have a question about Services in Android. I have a application with two Services A and B. Is it开发者_如何学C possible that Service A can stop Service B? I dont want to do it through a Activity, cause the Application will be in Background. If some special Event happen in Service A, then it should tell Service B to stop. How can i do that?


You may need some other way to obtain an object of SeriviceA but this is the basic idea. Services are Contexts just like Activities are.

stopService(new Intent(ServiceA.this, ServiceB.class));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜