Is it possible to communicate between two android phones? - android

I already read following question and answers.
How to communicate between same application installed on two android handset?
I think the use case is totally same as mine.
But I still have a remaining question - what does 'using internet' in the article above mean between two phones each far away?
I think I need some more explanation in detail.
Thanks in advance.

Yes, two applications can talk over the internet (or bluetooth or sms/mms for that matter, but less practical). Just like any two computers can communicate over the internet. There's a wide variety of protocols. A whole world really. Do you need references to some tutorials on networking or am I totally missing your question?
EDIT: You can try The TCP/IP Guide for an intro
EDIT: And for android you probably want to use their socket interface
UPDATE: About how to communicate between clients - you probably don't want to rely on knowing a particular peer's IP address. Usually what you do is work with some known host as a server, which coordinates between the peers, sometimes relaying the messages between them, or alternatively just notifying the clients about each other's addresses.

Related

What is involved in connecting an app to a mac via Bluetooth?

I realize that this is the kind of question that frequently gets a lot of (well deserved) "what have you tried" comments and down-votes, but I'm hoping that by the time I'm done asking I can avoid that.
I've been looking around but unable to find the answer to how one goes about writing an application that consists of the following three things:
An Android app that connects to a host device via bluetooth
Communication io layer that sends signals back and forth on
that bluetooth connection
A host resident native app (preferably Unity3D, or AIR) that can receive/send messages back and forth to the connected app.
I have written many Android applications so I am not in need of any kind of "getting started" hand-holding, rather I just need some guidance (preferably in the way of a web link or book tutorial) on what it takes to utilize bluetooth and how one actually communicates via it.
Thanks in advance for all useful tips.
Here are a few links that I found in terms of Bluetooth connections
First of all the dev guide(I assume you have already looked here, but if not this is a good place to start)
http://developer.android.com/guide/topics/connectivity/bluetooth.html
http://developer.android.com/reference/android/bluetooth/BluetoothDevice.html
This one is a basic tutorial on how to Bluetooth on android
http://luugiathuy.com/2011/02/android-java-bluetooth/
This is a long PDF on Bluetooth programming in general (I haven't read it, but from what I have seen it looks over in depth) it covers java and OSX, but not android
people.csail.mit.edu/rudolph/Teaching/Articles/BTBook.pdf
Here is a similar SO question which might contain helpful links
Code samples for Android Bluetooth programming
This is the best Bluetooth open source project that I could find for android, it doesn't fit your description over well, but here it is anyways
http://code.google.com/p/bluetooth-remote-control/source/browse/#svn%2Ftrunk%2Fsrc%2Fpro%2Fapus%2Fblueremote
I realise that a lot of these links are simpler than what you really want, if I find anything more complicate I will add that.

Is it possible to scan for wireless clients using the Android SDK?

A understand that the WifiManager returns a list of access points after a scan, but is it possible to also retrieve a list of wireless clients and their strengths?
Update:
To clarify what I mean by a "wireless client", in a typical WiFi network there is a WiFi "access point" and one or more wireless clients that communicate with it.
Some comments are saying it is not technically possible without querying the Access Point, which makes sense.
I have used a tool such as airmon-ng to list all access points and every client within range. You can see there is a client, signal strength (PWR) and which access point (STATION) they're connected to in this screenshot:
For this to be possible there are a few things required. Firstly your device needs to have 'monitor' mode support. This is because all network interfaces will ignore traffic not intended for them unless otherwise told to do so, this is not needed for normal operation so not all devices support it.
Secondly you will need a rooted device as shell commands need to be executed with root (administrative) access. If your phone is not unlocked and rooted this will also not be possible for you.
Thirdly, you will require either a kernel that supports monitoring and snooping on your wireless chipset, or a kernel module that will add this support. This is a technical detail that I will not go in to here, but Googling it will help you.
Last you require a toolset such as airmon (Like you've used on your PC) for Android, there is one on the Play Store here: AirMon.
A word of warning, expect to be on your own out there. Finding a developer that writes these kind of kernel modules or hacking/penetration related tools is usually not open to hand-holding. You will have to Google and help yourself for the most part, or ask more questions on StackOverflow of course.
So the Cliff Note, TL;DR. It's possible, very possible. But you might not be able to do it on your device.
Also, I'm not aware of your skill-set but the hours and skills spent getting this sort of thing to work on a PC let alone a phone are long and vast, so it's best to use the tools others have provided, developing them yourself is going to have a steep learning curve.
I don't have the exact answer on how to do it but I seen app in Play store that does exactly what you're asking which mean it can be developed. Quick search show this one - https://play.google.com/store/apps/details?id=de.android.telnet
i had this issue a while back but unfortunately the only solution really is to query the router. now it depends if your router can do this. i wonder if 3rd party router roms like ddwrt can spit log files which then you can parse

How to create P2P Android Remote application?

I would like to develop a Remote application for Peer-to-peer Android Device using TCP/IP connection. once one of the device successfully remote to the other, he/she will be able to see what the other device is doing (example : doing drawing with an application, etc).
Is this possible to do or there is other way that is more efficient to do ? Any reference/road map is appreciated. code samples are greatly appreciated.
Here have pair of projects implementing a remote service and a client for it:
https://github.com/commonsguy/cw-advandroid/tree/master/AdvServices/RemoteService/
https://github.com/commonsguy/cw-advandroid/tree/master/AdvServices/RemoteClient/
I think this can help you..
Thanks...
If remote means on the LAN, you can use IP multicasting. If remote means the WAN, then you'll need a fully fledge P2P framework, with NAT traversal solutions, such as JXTA for example. Google JXTA and you will find info, including code samples. It is not the only solution, you could explore JGroups too.
There are UDP based P2P frameworks too. These are a bit better at NAT traversal, but you're left with the duty of putting the pieces of the puzzle (i.e., data slicing) back together.

Is it possible to modify WiFi frames (layer 2 PDUs) to include new fields?

I want to develop an app that makes use of the WiFi interface to establish cooperation amongst a subset of mobile devices, which will then allow me to exploit location information and achieve higher energy efficiency (cluster based communications).
For security reasons, I must append a digital signature (or a keyed hash) at the end of specific WiFi frames (e.g. when ARP protocol runs).
Is it possible to achieve this in Android OS?
Will I be able to update the WiFi protocol stack in Android?
Will it be feasible?
Any literature suggestions?
I'd be grateful for any directions.
Is it possible to achieve this in Android OS?
I think you would need some kind of raw sockets. For that you can look to Raw Sockets on Android
Will I be able to update the WiFi protocol stack in Android?
Android is open source so you can try to modify it and load another Android firmware to your phone. For example, you have custom firmware versiones like the one you find at http://www.cyanogenmod.com/
Will it be feasible?
In my opinion it is possible but very difficult. Probably you can find a more feasible solution for your problem.
Any literature suggestions?
You can read this threat about how to download and edit Android source code: http://groups.google.com/group/android-kernel/browse_thread/thread/6e428031c5e70417/8d99386a62f7d75e?pli=1
Good luck.

How to handle bidirectional data transfer between networked devices and a server?

I had a hard time framing that question. I hope it gets the gist of my idea across.
So just to state a few points before you decide to answer. this is a project I am doing for school and it is my own idea and proposal.I am NOT looking for code. I want to hear ideas to architect a system. This thread is more of a discussion than a simple answer. So any and all input is welcome. I will be developing this application over three months and I am using the internet to brainstorm.
So the system consists of several mobile devices and a controller device. the controller sends questions that each mobile device receives. they answer it; the controller gets to see statistics in real-time on their phone or desktop. the mobile devices can join the controller's session to be able to interact.
In Java EE, I can store the controller device data in the ServletContext and the mobile device sessions can add themselves to the controller device's data_space in the ServletContext. This way the controller knows who is logged in and it can retrieve the responses of the other mobiled devices. The problem here is the issue with multi-threading as the ServletContext is not threadsafe and Sessions are all multiple threads. There is also the issue where I think this is a not a good design choice. In fact, I feel this is the most straightforward but wrong design choice to make. I would like to hear possible ideas to architect a system to deal with this kind of communication.
Also, would this problem be best solved by using the database? Would such a database centered approach affect the speed of the application? also, am I right in thinking that the database will have no problem dealing with multiple threads since it is a serial pipeline. Database in question MySQL. I am thinking of creating a unique VIEW that will be alive for the lifetime of the controller's session. the mobile devices can get the controller's unique VIEW by checking with the ServletContext and then adding themselves to the View and manipulating data in there. Is this a decent approach to the problem?
thanks for looking. :)
Good discussion.
I think that the best solution is to use a database. You should use the MVC Model View Controller pattern. In this case mobile devices will be clients which comunicates with a controller (Java EE servlet) through an http connection.
The servlet will handle the database. If a database is hosted in the same server that a Java EE application is deployed, your speed will be very good.
I don't really understand what you are you thinking on doing with the VIEW, if you explain me better we could continue the discussion with that point.

Categories

Resources