The interaction between Java and Android

I'm currently trying to learn how to use Android with an existing Java based system. Basically, I need to communicate with / from an Android application.

Currently, the system transfers object data from computer to computer using ActiveMQ as a JMS provider. On one of the computers a display is displayed that shows the object data to the user.

Now we want to use a phone (running Android) as another option for displaying object data to a user with network / network access.

Ideally, we would like to have our own Android application that will listen to the ActiveMQ topic and publish to another topic, as well as read / write / display object data, but from some studies that I did, I'm not sure if this is possible.

What are other ways to solve this problem? An Android phone should be able to send / receive data. I am using AndroidEmulator for testing.

+4
source share
1 answer

The quick and dirty way is for your JMS to send data to the XMPP / Jabber server and use the XMPP library, such as the Smack API on Android to connect. The advantage of this approach is that

  • You can emulate point-to-point and pub / sub in JMS.
  • XMPP is quite extensible, so instead of porting your payload as chat text, you can create your own namespace in the XMPP package. For data portability, you can use light weight such as JSON in the namespace.
  • XMPP will handle your presence for you, so your application does not need to track services if they are online.

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

+4
source

Source: https://habr.com/ru/post/1306315/


All Articles