的Java和Android之间的互动 [英] Interaction between Java and Android

查看:104
本文介绍了的Java和Android之间的互动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在研究如何使用Android与现有的基于Java的系统。基本上,我需要从一个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.

目前,该系统由计算机使用的ActiveMQ作为JMS提供者传递对象数据到计算机。上的计算机中的一个是显示器,其显示了目标数据给用户。

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.

我们现在要做的是使用手机(运行Android)作为另一种选择这个对象的数据显示与WIFI /网络接入用户。

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.

在理想情况下,我们想对Android的原生应用程序,它会听ActiveMQ的主题,并发布到另一个话题和读/写/显示对象的数据,但记者从一​​些研究,我都做了,我不知道这是可能的。

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.

还有其他的方法可以解决这个问题呢? Android手机需要能够发送/接收数据。我一直在使用AndroidEmulator进行测试。

What are some other ways to approach this problem? The android Phone needs to be able to send/receive data. I have been using the AndroidEmulator for testing.

推荐答案

一个快速和肮脏的方法是让你的JMS的数据推到一个XMPP / Jabber服务器,并使用XMPP库一样的拍击API在Android 的连接。这种方法的优点是,

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. 您可以模拟点至点的JMS和发布/订阅。

  2. XMPP是相当扩展的,这样你可以做的是不是携带你的有效载荷聊天的文字,你可以创建你的XMPP包内自己的命名空间。对于数据的可移植性,可以在命名空间中使用一个轻量级像JSON。

  3. XMPP将处理您的presence给你,让你的应用程序不必保持服务的跟踪他们是否在线。

有一个很好的文章的这里,告诉您如何在Android上使用巴掌。

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

这篇关于的Java和Android之间的互动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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