How to create P2P Android Remote application? - android

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.

Related

Android Bluetooth Server

Checked so far : this stack post, this one and official docs
I am not really familiarised with the Bluetooth api, yet I couldn't find something to clarify based on my need.
What I am trying to achieve is: Using my android device (as server in this bluetooth connection) to push data to the other device (which can be on any platform)
Seems simple, and I might think about it in a complicate way (was thinking I might provide some interfaces / callbacks to the client part)
Also, my implementation should not affect the client side.. I am a bit stuck into this, if anyone could clarify it a bit, or come up with a decent sample where the code is described a bit,
Thanks in advance, and Happy Coding !
your phone can act as a master(host) device Here is a example you can implement
https://github.com/bauerjj/Android-Simple-Bluetooth-Example
this example uses Bluetooth to connect with HC-06 module but you can use it with other devices

Is it possible to communicate between two android phones?

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.

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.

Android Bluetooth: file transfer over BluetoothSocket

I wish to perform device-to-device file transfer over Bluetooth in my Android application. Currently I have written the code necessary to make connections between multiple Bluetooth devices and I have retrieved connected BluetoothSockets for data exchange.
Is there a library available which implements file transfer that can be given a socket, or streams to use?
If not, can someone point me towards information about implementing the ability myself?
I am very new to file transfer programming and Bluetooth, so any help is appreciated.
Also, because I want this functionality built into my app, I am not looking to just run some other end-user app on the phone, I really do need to be able to code against this functionality (whether via a library, or my own implementation).
Normally over Bluetooth you would use something like OPP.
However that doesn't seem to be implemented on Android yet...
What I would do, is try serializing the data and sending it via RFCOMM or SPP bit by bit. For XML there is XStream, or, even simpler, Google's Protobuf.
Let me know if it works.

Bluetooth remote control using android

I have an android tablet and have an application installed on it... Now i need to control this application on the tablet through my android device... is there a way to do such thing?
Explore this example project by Google
http://developer.android.com/resources/samples/BluetoothChat/index.html
see how it works and try to implement your programming skill to transform this chat application to your idea...
How ever I am assuming that you are the author of application which you have desire to control.
happy coding.
EDITED:
Logic structure is simple both application should be able to detect bluetooth and paired(connect) with each other for communication. once you have communication instead of sending message(in chat) you send some information via buttons which will execute some methods on tablet...Just a thought... As if in chat application you can update and add messages to your thread...this application will help you to reach goal. Lot of work though!
If you are familiar with Sockets, this shouldn't be a problem for you, because the Bluetooth-connection and communication in Android is very much the same. See the Bluetooth-Tutorial and Googles "Bluetooth-Chat" example.

Categories

Resources