I need a very simple server that listens for connections, retrieves a question and simply answers yes or no. Then the connection is broken.
As my Android device is the only device that is powered on and connected to the internet 24/7, I'm thinking of using it as the server.
Is this possible, and how could I achieve this? The biggest problems that I'm facing is the ip-address, as it could be changing a lot. I'm thinking of storing it in a public dropbox file, so the client can retrieve the address from that
There's a whole slew of reasons why you shouldn't use your android device as a server, but I won't go into those. I'll just assume you have a good reason for doing what you want to do.
Since your question is very general, the best I can do is give you a very general answer. You'd implement a server on android like you would any other server using java using sockets. For a simple java implementation of a socket based server, checkout this tutorial. The tricky part is going to be getting your IP address to share with clients so that they can connect to your device. As nick suggested, dyndns might be an option here, but I'm not sure if they have a mobile client.
Related
I am making a project and I need to get data from the Arduino to a server (I don't have a server), and the read this data from an Android. And the same on the other way (from Android -> to the server -> to the Arduino).
I newbie to dealing with servers. I am trying to figure out which server to use (I need to save a database on it also...). I know this one:
www.parse.com
and I have read about Microsoft azure.
How can I choose with which one should I work? where can I start from to read about this?
and if you have suggestions for a free server, I would be glad if you tell about it.
There are many variables that go into the decision of what services you will need. Microsoft has a suite of IoT products that can get you going.
Here are some great resources to get you started on the Azure IoT suite. Take the time to read through and figure out which services you need.
http://azure.microsoft.com/en-us/documentation/scenarios/internet-of-things/
https://channel9.msdn.com/Events/Build/2015/2-67
https://dev.windows.com/en-us/iot
The biggest thing you need to consider with the server is the kind of data you will be collecting and how you want to store it. As far as being able to connect to the server with both Arduino and Android, any service you choose will be able to be accessed by both platforms.
Azure is a good option because there are a lot of pre-built solutions that you can modify. You can find a high level description of different solutions here.
I am looking for an existing library to establish a connection between any smartphone(android/ios/win phone) and a web page.
Sort of what whatsapp is using (https://web.whatsapp.com/), with authentication.
Once the connection is established, i will have to send real time data ( audio and text) from the phone to the pc.
I suppose that whatsApp use a server to relay the data. i dont mind doing the authentication with the help of a server but once the connection is ok,I prefer to do all the communication on wifi instead of sending data from the phone to a server and sending it back to the web page on the pc.
Thanks!
When you want to solve a particular problem which is already solved, You don't want to reinvent the wheel(especially in web) but use the existing solution.
What you are looking for is WebRTC. Fits exactly for your use case. But i am not sure about the development efforts required for this.
There are Client libraries in almost all languages. A quick search gave this for Android
And i am not sure about the device support you are expecting, check Caniuse?
Also have a look at WiFi-p2p for android.
UPDATE:
check this webrtc website for cross platform development support and examples.
There is no real "best" way of doing this, but you have to have a server of some type running on your computer. From there you can use normal network requests from Android to communicate with your computer as long as they are on the same network (WiFi). https://developer.android.com/training/basics/network-ops/connecting.html
Starting to build an app where we will have a desktop and a mobile client applications. These two apps will exchange messages/info on frequent basis. The idea is not to have any server/central entity for this communication. We want to send/receive messages without any server implementation. I googled on these and got peerjs.com, openpeer.org and google project apprtc. Peerjs and apprtc are kind of web based applications which are not in our kind of.
But still it's not very clear on how this things works out as they involve any server or not. Kind of stuck and not sure where to start and how. Is it possible at all?
We are not yet tied to any platform, so open to any kind of implementation. Please share if you have any similar experiences of any applications using this kind of technical stack?
use webrtc ios project, and its what you need
https://github.com/gandg/webrtc-ios
Sockets is what I'd use, assuming the network requirements mentioned above
Those two devices may or may not be on the same network.
Then you need a server of some form, whether you want one or not. That server may simply be a data broker (see PeerJS) or provide more functionality, but it must exist. That server may be one that you host yourself or be some common cloud provider, but it must exist.
I am building a mobile device that needs to send realtime information to other devices. I have considered XMPP but I do not have a server, so the communication must be only between the devices.
Is there a way to communicate using XMPP between mobile devices without a server (Or using the mobile devices as servers)?
Is Sockets a good idea ? i.e. Having a ServerSocket and client Socket and communicating this way.
Is there a smarter way? I have heard of jWebSocket but I dont really know how it works or if it's worth it.
EDIT
The process is as follows:
I'm using Parse as a server/backend http://parse.com
When the user runs the app, a user list is retrieved from the parse server
The user then has (Could have) the ip of other clients and then attempt to communicate with them.
Problems
1. Parse does not support a XMPP server or other type of servers
You might look at using an IRC client library like http://jerklib.wikia.com/wiki/JerkLib_Wiki. This way you can use a public IRC server to communicate with your other devices...
I've not used it, but I did bookmark it for further reading because I thought it a novel concept ...
I hope it helps...
I'm trying to find a solution to listening for a request from a server.
The server would send a String to the phone, based on the ip address of the phone and the android app would take action when it happens.
Has anybody here faced a simular problem and can direct me to an example on the web or something?
Thanks
You can use sockets for it. See here and here.
You can't really be sure of a mobile device's IP address. It can change as you switch between WiFi hotspots, or as you move to a different 3G area. For this to work, the mobile has to register somehow with the server. The usual way to implement it is to keep an open connection, where the server responds with data only when it wants to notify the client. It is possible to create your own implementation, but not trivial. Android has a standard way to do this called Cloud to Device Messaging (C2DM). It is used by GMail and other Google apps, so it's fairly reliable. There are other services that provide something similar, you might want to look into those if C2DM doesn't fit your needs (it requires a Google account, etc.)