Server on windows, clients on android - java

I am now trying to do a project which is, there will be a server on windows pc and there are some clients on android devices.The point is the server one should control the android devices.For example it choose a image or video, send them to the clients and the clients play or show them.Remember the clients should be control by the server.
So could anyone tell me a proper way to do that, which protocol should i use, how do i send the files to the clients and how do the clients react? I am thinking of using java for the server and of course the client will use android application.
Thank you.

You might find Cloud to Device Messaging (c2dm) useful: http://code.google.com/android/c2dm/index.html
In essence, c2dm allows a remote server to send an Intent to an Android app. The device-side app can then respond to that intent to take the requested action. Chrome2phone works this way to open web links on a target device. http://code.google.com/p/chrometophone/

Related

biometric authentication java aplication. how to build the connection between an smartphone and application

I have to develop an biometric authentication application.
The application will be written in java and it will be an desktop app, I want to use my smartphone for the fingerprint sensor, but I don`t know how to build this connection betwenn application and phone.
The main application will be installed on a computer without web.
I would be grateful if you have any idea or examples how to do this. Thank you!
You should have an app on your smartphone which uses the fingerprint authentication API.
If you are looking to use an android phone, you can refer this
https://developer.android.com/about/versions/marshmallow/android-6.0#fingerprint-authentication
You can create a simple APP using this API.
When user authenticates, then you can send message to your desktop java application from this App.
By 'without web' if you mean without internet, but can be connected to a local network, then you can send message via TCP/UDP.
Or if you wont be able to connect to any network, then you can try bluetooth.
If bluetooth is also not available, then you can connect your phone to your computer via a USB cable and communicate using Serial communication. There are a few external libraries available for this.

P2P communication , chat App (android)

i am using this tutorial as guide. i am creating an android app which is basically chat application. this uses socket programming to communicate .
i want to connect directly to device and deliver the message. the message does not go to server. server only tell me the address of the device thats it.
i followed the tutorial i mentioned above and this only works for the case where client and server are within same wifi/network. i want to connect to server from client irrespective of their network connection place. how do i do it from any network to any network.
i think i need to use port forwarding , but this is not practical . so we better use a server for keeping track of all the ip changes. and deliver the messages directly from the source to client. so how do i do it. please suggest any resources.
update
as of now what i studied is i have to use innetaddress to communicate if i am inside an wifi router.
thank you

How can an Android application function as a remote controller to a desktop application? (Spotify)

I am in the planning stages of developing an Android application to control my Spotify player. Since I am running Debian on my system, the options that are available on the Play Store are quite limited (I can't find any functioning apps). Therefore, the programmer inside me tells me to build one. I haven't built an Android application before, but I have good experience with working with APIs so I think this could be a pretty decent starter project for me.
However, I am having some difficulties grasping some of the concepts on how I could implement this. With some research of the Spotify API documentation, I believe the Spotify Apps API is the one I should be using to control playback on the desktop.
On the Android side of things, I would imagine I would use the Spotify Apps API in conjunction with the Libspotify API to receive metadata and display what the application is getting from the desktop playback.
What I am having troubles understanding is how does the Android application talk with the Spotify desktop client? I have a few ideas, but I am unsure...
My thought process so far is as follows:
have a local webserver on the desktop open up and begin listening
on the Android application, connect to the desktop's webserver (how do you do this?)
once connected, the desktop sends metadata/other information to populate the Android application
from the Android UI, hitting a UI button will send a request to the webserver, where it parses the data, completes an action, and then returns the response to the Android application
I am a little lost on what tools I need to learn and use to get this working. Any suggestions to the implementation are greatly appreciated!
Thank you!
Your approach is correct.
On host (desktop), open a socket and listen on port 80 (or another port if you wish) and listen. It doesn't need to be a full web server.
On client (Android), to start with send an http request to the desktop' ip address. Desktop responds with a simple web page.
That's how you get the two communicating.
Then you can start POSTing data to the desktop and returning data in the web page.
Then you can move to communicating using JSON rather than web pages.
You can program both the host and client using Qt. You can develop both on the desktop and move the client to Android (or iPad) when you have got it working.
Yes, you are on the right track. If you know java then you can use Java Sockets to connect android and desktop. It should work on Debian. On the server side, you need to create a socket on specified port.
ServerSocket serverSocket = new ServerSocket(PORT);
Then wait for a client to connect
Socket clientSocket = serverSocket.accept();
On the client side, create a socket and connect to the server using IP and port
InetAddress serverAddr = InetAddress.getByName(“SERVER_IP”);
Socket socket = new Socket(serverAddr, PORT);
You can control a lot of things on your desktop using java.awt.Robot class. It let's you simulate keyboard and mouse events. So if you have some hotkeys enabled for Spotify then you don't need Spotify APIs to control it. Just simulate keyboard event. So if spacebar is a hotkey for play/pause then run this on server
robot.keyPress(KeyEvent.VK_SPACE);
This article explains this complete process by creating a simple remote control for vlc

Is it Possible to run both Server and Client android applications Locally?

I'm looking to program a network application. I was going through: http://www.stanford.edu/class/ee368/Android/Tutorial-3-Server-Client-Communication-for-Android.pdf which talk about server and client programming for android. Now imagine I don't have an internet connection and I want both server and client applications run on either same android device or different android devices locally.
Is it possible to develop and run both server and client applications using TCPIP/UDP/Multicast locally on either standalone android device or multiple android device?
Yes, it is possible to communicate between Android devices or applications that are not connected to the Internet.
If you are using different devices, you probably want to use sockets, but it is possible to run an HTTP server on the server device and then use HTTP. Make sure they are connected to the same wifi network.
There are several different ways to communicate between different processes on the same Android device. The easiest might be to use a Messenger service but sockets and HTTP are also possible here.
Yes, it is possible in some manner.You can either use sqlite database present in android device to store various types of data in table form and data retreive from same.
Another way is to use Parse cloud as a server or backend of your client application.It allows your app to run even when you are not connected to internet.It stores the data in cache memory with its api and then uploads data to the server cloud as soon as you get connected to Intenet.
You can ask if you have any further queries. :)

Create a basic network app

I have a little question about an android app with a function "remote" use via internet.
So I have these ideas:
Create a webservice using php on the server, and refresh the client app all x time like 4-5 sec
Or make a java server (so I don't know how I can do that)
I just want make a remote connected via user/password to the server and the other app connect to the server and refresh his status.
Do you know the best way for do that?
Thanks
The question is not very precise, but as far as I understand it, both your ideas implement the 'pull' concept, that is the client app checking the status of the server every now and then.
If you want the app to be instantly notified of the server status change, I would suggest push notifications with GCM (Google Clound Messaging). You can find some basic descriptions and examples at: http://developer.android.com/google/gcm/index.html
Sending a server-to-client notification is simple regardless of the platform you use server side. E.g. for PHP integration with GCM, check out this thread: GCM with PHP (Google Cloud Messaging)

Categories

Resources