简体   繁体   English

从Android中的另一服务调用一个服务

[英]Calling one service from another service in android

My main app starts 2 services Input-service and Save-service. 我的主应用启动了2个服务Input-service和Save-service。 My Input-service is generating input which i am able to show in my Main app and my both services are starting successfully. 我的输入服务正在生成可以在我的主应用程序中显示的输入,并且两个服务都已成功启动。 I am facing problem in calling one service from another. 我在从另一服务调用一项服务时遇到问题。 Means how can i send data of Input-service to Save-service. 表示我如何将输入服务的数据发送到保存服务。 Is there any example which shows communication between two services. 有没有显示两个服务之间通信的示例。 Or can anyone help me regarding this. 或者任何人都可以在这方面帮助我。

Why not use BroadcastReceivers ? 为什么不使用BroadcastReceivers Register them in onCreate , de-register in onDestroy and send data through intents ... onCreate注册它们,在onDestroy注销,并通过意图发送数据...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM