开发者

Interaction between Java and Android

I am currently trying to research how to use Android with an existing java based system. Basically, I need to communicate to/from an Android application.

The system currently passes object data from computer to computer using ActiveMQ as the JMS provider. On one of the computers is a display which shows object data to the user.

What we want to do now is use a phone (running Android) as another option to show this object data to a user with wifi/network access.

Ideally we would like to have a native application on the Android that would listen to the ActiveMQ topic and publish to another Topic and read/write/display the object data, but from some research I have done, I am not sure if this is possible.

What are some other ways to approach this problem? The android Pho开发者_StackOverflow社区ne needs to be able to send/receive data. I have been using the AndroidEmulator for testing.


A quick and dirty way would be to have your JMS pushes the data to a XMPP/Jabber server and use a XMPP library like Smack API on the Android to connect. The advantage of this approach is that

  1. You can emulate the point-to-point and pub/sub in JMS.
  2. XMPP is quite extensible so what you can do is instead of carrying your payload as 'chat' text, you can create your own namespace within the XMPP packet. For data portability, you can use a lightweight like JSON in the namespace.
  3. XMPP will handle your presence for you so your app don't have to keep track of services if they are online.

There is a nice article here that shows you how to use Smack on Android.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜