开发两款Android应用程序和两者之间的通信 [英] Developing two android apps and communicating between two

查看:155
本文介绍了开发两款Android应用程序和两者之间的通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发两个应用程序名A和B

I am developing two applications names A and B.

应用程序A为活动命名MainActivity,服务,称为UpdateService,broadcastreciever称为UpdateReceiver。

Application A as activity named MainActivity, service called UpdateService, broadcastreciever called UpdateReceiver.

应用程序B为命名活动TestActivity,服务,称为DoService,broadcastreciever称为DoReceiver。

Application B as activity named TestActivity, service called DoService, broadcastreciever called DoReceiver.

在我applicayion B,我要访问一些方法和MainActivity code这是在应用程序A

In my applicayion B, I want to access few methods and code from MainActivity which is in Application A.

在这种方式,我需要完全控制中的应用A code到accesss它在我的应用程序B

In this way I need full control of Application A code to accesss it in my application B

我怎样才能实现呢?

推荐答案

您无法直接访问不同的应用程序活动的方法。

You cannot directly access methods of Activity in different app.

广播会工作,但如果你想要更多控制(即调用远程方法)考虑绑定到远程服务中的其他应用程序或使用信使和处理程序进行通信。

Broadcast would work but if you want more control (i.e. invoke remote methods) consider binding to a remote service in the other app or use Messenger and handler to communicate.

下面是<一个一个简短的教程href="https://web.archive.org/web/20130731024012/http://$c$c.google.com/p/openmobster/wiki/InterAppCommunication"相对=nofollow>跨应用通信

这篇关于开发两款Android应用程序和两者之间的通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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