Sync desktop application with android application - java

I want to raise an event from my Android application to my desktop application which is in Java. Can I do so? If yes, which API to use? Any examples or code snippets?

Both android and desktop applications are clients. Two clients can talk to each other via server or at least initialize their connection via server that is running on pre-defined location (IP address). So, you need some server that allows to do this.
You can probably use (or abuse) some 3rd party servers for this. For example if your desktop application "knows" the phone number it can send SMS via one of available web services. The android application will catch the SMS and take information from its text. You probably can use Skype installed on your machine or email to send messages among applications too. But better way is to develop your own server that exposes RESTful API and use it for the negotiation.

Related

connect and communicate between Windows application (c#) and andriod apllication (java)

I am trying to connect and communicate between Windows application and andriod apllication. I have used .Net Socket but it is only appllicable for windows. how can i code in andriod application using Java programming language and make communication between two seperate devices (windows and andriod).
I want windows application act as a client and andriod apllication as a server. The server receives the data from client, processes the data and returns the result to the client.
Thank you all in advance
There are several ways to connect and communicate between a Windows application (developed in C#) and an Android application (developed in Java). Here are a few options:
1/ Use a web service: One option is to create a web service that both the Windows and Android applications can access. The web service can be hosted on a server and both the Windows and Android applications can send HTTP requests to the web service to retrieve or send data. This is a good option if the applications need to communicate with each other over the internet.
2/ Use a local network connection: If both the Windows and Android applications are on the same local network, you can use a local network connection to communicate between the two. For example, you can use sockets to create a connection between the two applications and send data back and forth.
3/ Use a shared database: Another option is to use a database that both the Windows and Android applications can access. You can set up a database server and have both applications connect to it to retrieve and store data. This is a good option if you need to store large amounts of data and need the data to be persistent.
4/ Use a cloud service: There are also several cloud services that allow you to easily connect and communicate between Windows and Android applications. For example, Google's Firebase provides a real-time database that can be accessed by both Windows and Android applications, as well as other features such as push notifications and authentication.
It's worth noting that each of these options has its own set of pros and cons, and you'll need to choose the one that best fits your needs.

Java library + app to send push messages to android device

I am doing a lot of long lasting computation stuff in java and want to stay informed.
Is there any standard method ( library etc. ) to send push notifications from a desktop java program to my Android device?
When there is no , could someone provide me with some starting ideas how to write this on my own?
The "3rd-party application server" mentioned in https://developer.android.com/google/gcm/server.html can also be a desktop pc running a simple java program.
You will need to setup some IDs, an app that receives push messages, a way to display the phone registration ID so you can enter it in the desktop app.
But the rest is basically as simple as adding the gcm server jar to a desktop app (I'd use this version here: https://github.com/kurthuwig/gcm/commit/d37f4d1c37ed8deaf1a161ca7b881c1d843f80df ) and then calling 3 methods or so.
Like what zapl suggested I would say GCM is a good choice. Also, all benefits aside, if you're into messaging you can have a go at AMQP, specially the RabbitMQ implementation. You can run the RabbitMQ server on your desktop and push your messages out to all listening devices.

How to share database between same application in multiple devices without server

I have created database in one application and that application is installed in multiple devices.My requirement is that if i change the value in database of one device then,that changes in database should reflect in another device of same application.I need it without server/third api.
Thanks in advance...
This is precisely when one does need a sever.
Stop and consider what it is that you are asking for. You need a way for a phone to notify all other phones that hold the same application about a change. Phones are not directly addressable to each other via the web, which makes any kind of peer to peer algorithm tricky. SMS texts is the closest form of direct addressing that phones do support, thus it could be used to build a peer to peer protocol, but that would be tricky, unreliable and is unlikely to be beneficial.
A server on the other hand is the standard approach to solving this problem, the server acts as a shared agent that all phones that connect to the web can address easily. Even if the server is just an FTP server on a freebie hosting site.
You need to implement a server functionality in your android application.
What is a server : A server is a running instance of an application (software) capable of accepting requests from the client and giving responses accordingly. Servers can run on any computer including dedicated computers, which individually are also often referred to as "the server".
For further information,I would like to provide this link which will clarify you about communication between two devices Android - communicating between two devices (Use of bluetooth etc.)

Web Server vs. Socket Server for android app

After a lot of research i am more confused then before on what kind of server to use for an android app.
My question in a nutshell is: which kind of server is easier to use and deploy.
I want to create an android application that communicates with a server to find other clients, the server uses GCM to notify other clients that one client wants to communicate and is used to exchange the address of the clients. Afterwards the clients should be able to communicate directly to one another.
What i found out is that from the android point of view either would be fine, both is likewise possible and neither produces more work then the other.
On the server side it looks like web service would be better to use, because it is easier to find a server provider. I might be wrong here but it looks like most large server providers don't like to give you enough access to run a jar file.
Google and amazon offer servers that can host web services, i am not sure if a socket server would be possible there, so if anyone can give me some tips on good and affordable server providers i would also like to have some insight there.

Java based mobile app+IIS server

I want to develop a mobile application which can work in GPS/GPRS based phones. I heard like Java is the most suitable platform to develop that. But I want to connect this mobile application to the IIS server. Is it possible?
I have one more query.
Is it possible to deploy applications developed using .net mobile in basic gps phones?
Yes. It is possible.
In order to communicate with your IIS server ,
you can create webservice and deploy it over IIS and consume it from j2me app/
you can use URLConnection to make GET POST request to your IIS Server from J2ME Application.
First one is more preferable.
Introduction to J2ME Web Services

Categories