I want to develop an android application for LAN calling.My app resembles apps like whatsapp, viber etc, so I googled for the same. What I got from different answer is:
Whenever we install whatsapp, the whatsapp server register our number and contact list. The app continuously pings the server and update its status on server.
When we open the app, it gets the data from server, and if a number is found in contact list, it displays the status of the number and other things.
Whenever we message some one, the message goes to server and stays there until delivered successfully.
For my app the two steps are:
Find all the devices which has my app, their IP and mac address.
When devices are found,allow calling between them.
For step 1, I have two options:
As whatsapp, I can have a server. It registers the info of the mobile phone, whenever the app is installed. The app pings the server and shows its status.
I can use my own network device discovery code. This code scans the network and find the devices.
This step is costly, whole network is flooded with the packets. And also it is quite difficult to write network device discovery code.
For step two, I want to implement client-socket programming and simply connect the microphone of one device to the speaker of another phone. I think it is challenging, but it is possible.
Please help me with network discovery code or the server setup. I am quite familiar with android development, but very novice to networking.
Also how calling is done between these devices?
I have searched for the answer and found the following links: Peer-to-peer SIP call with Android SIP Stack?
how to implement voip in android
VOIP on Android libraries or sample code
I also put a question on quora:
https://www.quora.com/How-can-I-develop-an-app-having-feature-like-whatsapp-calling-in-android
But, still I am stuck at the beginning. Please help me with it.
Not a complete answer yet, but here are the things to look for:
Assuming Java is your language, use Multicast Network discovery in Java using multicasting and https://en.wikipedia.org/wiki/IP_multicast
Calling needs more description. Does the call starts immediately (as soon as the peers detect one-another) ? How does one know the identity information - a number or a username etc. ?
Related
I want to send notification from one android device (android tv without bluetooth, telephony) to another android device (phone/tablet). Both are on same wifi network. Through the notification, I want to launch an app or open a page in phone/tablet browser.
I went through GCM messaging and also saw some options where we can have a kind of http server on the phone running but could not understand implementation.
Can someone help with idea and if possible, some piece of code as well.
As I need it for demo, so even any hack solution is fine for me :-)
Thanks for any help or reading.
Your best bet as a hacky solution is to do simple Socket connection between two devices. Since they are on same Wifi, it will be simpler and won't have any firewall restrictions.
Avoid GCM, it requires setting up a GCM Server and then complex registration. It also makes your solution dependent upon Internet connectivity & Google ofcourse.
See an example here:
http://android-er.blogspot.in/2014/02/android-sercerclient-example-client.html
Basically one device such as TV can be a socket listener. The phone/tablet can connect to that socket and then you can initiate a notification on either device based on your requirements and data exchange.
Basically - the task:
On device one, text is copied to clipboard.
Device two must perform some actions with the text just copied on device one, for example invoke a browser with search engine page and query ?q=text-from-clipboard-just-copied-on-device-A.
First question: is it possible to do with out-of-the box applications?
Second question: if not, what are different approaches to do that?
Both devices are on the same local wi-fi network (connected via router). Connection via external ip server is not what I want, I would prefer a server running on device A or device B (android) if there's any, so there would be not need in working internet connection.
I see there's an option of Wi-fi direct (my devices are 4.0 and 4.2 Android versions, so it's possible). Is there a source code how to send a message with wifi direct and receive it on the other side?
First question: is it possible to do with out-of-the box applications?
No it is not possible with out of box applications. I would be surprised if there would be one!
Second question: if not, what are different approaches to do that?
One approach will be to implement Bluetooth Server and Client applications that can communicate between them and excange data. Ofcourse you will be able to implement different functionalities for example opening a webpage with the text as you mentioned in your question.
Or you can also have a look at NFC Communication explained here: (Remember the devices will have to be at very short distances to achieve such communication) http://developer.android.com/guide/topics/connectivity/nfc/index.html
I guess question 1 is not possible. I can't imagine that an out of the box app knows what action you want to perform with the received data.
Solution for question two could be working with tcp sockets. One device as server one as client, so that you can send your sting, link or whatever to the other device, which receives this and performs some action.
edit: Sorry, just read that you don't want to do it with internet permission, so data exchange via bluetooth, sms... could be possible
I'm trying to figure out what the solution is to having multiple android devices on one network share data.
Assuming all of them are running the same app, and a user "registers", I'd like to figure out (without any user input) what other devices on the network are available to be talked to and then to send them this registration data, so that when the user goes to the next device, their info is already there.
I'm able to ping the 255 connected devices in the x.x.x.0-255 range to see which respond, but am not clear on how I can write an app resident server (using the term loosely) that I could then send the data to.
I can't be the first person to need to solve this problem, but am unable to find anything useful on this front.
One caveat is that this is for devices that have no 3G (or other means) of getting to the internet, and the wifi network they're on won't have access to the internet either, so the solution has to be 100% internal network and can't include any additional devices (like a box running apache that all the device can use as a server).
TIA
but am not clear on how I can write an app resident server (using the term loosely) that I could then send the data to.
Create a Service that has code that opens a ServerSocket and listens on incoming requests, such as an HTTP server.
On the whole, this is dangerous, but for constrained circumstances -- such as your "100% internal network" -- it should be safe.
I'm trying to learn android and for my app i have few questions.
If i type a computer name on the EditText in my android phone, I
should be able to ping the device (So basically i need to first
resolve the ARP to get the mac address of the device which I want to
ping and then send the ping as an ICMP request).
I believe there is some command to retrieve the computer name and
send this ping command, but i would like to do it the hard way so
that i can learn stuffs better - It would be nice if you can show me
some pointers to some tutorial apps and open source code which does
similar tasks.
Once I have identified and connected to the device. I should be able
to start a chat with the device.
Assume the second device is also an android device, how can I
establish basic message sending from one android device to another.
Basically my app will be a client and server (I guess 2 services - service listening to sockets for incoming messages and client can send out messages).
Does anyone know any sample app / tutorials [basically code examples] which does this in android.
To Nr.1
I'm not quite sure why you first need to ping the device, as you could simply try to connect to the given device (using a timeout) and see if it can be connected.
I found some informations on this, here.
To Nr.2
So, if you want your Devices to communicate to each other, you'll want to use Sockets.
But, if your App is only for chatting and you don't need to know if the last send package was successfully send, you could also use UDP instead of TCP (So you don't need your application to run both the Server and the Client-Socket).
Although, all your questions could have been answered by doing a little googleing...
I've been looking around for some way to simulate Peer 2 Peer for games on the android and the best way I've been able to come up with is connected an android to a server and then routing through that server. I'm just looking for some thoughts on my way of solving the solution so that you could literally type in someones phone number and try and connect to them.
By use of a service module to check incoming text messages, which would be properly formatted for detection, it would interpret that another phone is trying to request a connection to another one of the androids applications. If the application is found it would then prompt the user as to if they wished to connect to the other person. If yes, their phone would send back a text message to the original phones, which also has the messaging system installed on it, which states it would like to connect and that this is my current IP address. The original phone, or host phone, would then open a connection with the other users phone via the Internet at which point the newly made connection could be used to transfer information back and forth.
Basic list layout
Service module:
- Writes/Receives formatted text messages to alert/verify someone is trying to connect to an application of theirs
- Sender attempts to make a connection with the recipient phone, which takes connection and passes to desired application along with sending back a confirmation package
- On confirmation Sender phone passes connection to original desired application.
Any thoughts, ideas, constructive criticism would be helpful.
* srry for bold, but I hope you understand why.
the best way I've been able to come up with is connected an android to a server and then routing through that server
This is called TURN P2P implementation. You want to read about STUNT implementations too. You'll probably be interested in the JXTA P2P framework.