Peer-to-peer phone application?

by Silver » Fri, 25 Sep 2009 07:27:14 GMT

Sponsored Links
 Hello all,

I'm with a group of college students making a multiplayer game as a
class project on the Android platform for the G1. Our primary goal is
to allow multiple phones (or for the sake of initial testing, a phone
and an emulator on a PC) to communicate with one another. Our game is
turn based, and we've been looking into TCP/IP and VNC proxy servers
to transfer data between the game clients on each phone, but none of
them seem particularly simple to implement. We've been through many
articles documenting how difficult peer-to-peer connections are on the
Android platform.

What would some viable network protocols to use for the sake of our
project and how should we go about setting them up?



Peer-to-peer phone application?

by Dan Sherman » Fri, 25 Sep 2009 07:48:58 GMT

 Put a server between them, and have each of them talk to the server.

NAT punchthrough and such isn't easy, and to be honest, with a game, you
want some sort of central system to make sure everything is legit
(anti-cheating) :)

- Dan


Sponsored Links

Peer-to-peer phone application?

by Roman ( T-Mobile USA) » Sat, 26 Sep 2009 01:52:33 GMT

 Right now there is no "real" P2P possible on Android using the
official SDK APIs.

In case of Wifi there is no support of Ad-Hoc. You could try to use a
multicast approach where you try first to discover which devices are
in the WLAN. Problem with multicast/broadcast on Wifi is that your
network performance gets impacted very fast when you add the number of
clients in the network. Also the type of traffic in the WLAN
influences the throughput.

If you think about using a central server then I would not all your
setup "P2P" anymore.

Roman Baumgaertner
Sr. SW Engineer-OSDC
T  Mobile stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.


Other Threads

1. Protecting data and application from illegal use


I was wondering about some real world issues about commercial

- Will there be a possibility for encrypted APKs as some of the
information included with the app (files, media, images, databases)
can be copyrighted with the need to protect it from illegal copy.
- Could there be an Android based solution for evaluation purposes and
time limitations?
- How can we protect our software from being just copied from one
phone to another? The trick would be to add some checksum files
created from serial no and phone info, but what are the proper
mechanisms for that? What is the unique and reliable info from the OS
or phone that could be used and could not be cracked very easily?
- How to protect data in SQLite? For example, the software needs a
load of data that will be stored in database after initial launch. But
the data could be also suitable for other illegal purposes - sharing
on Internet, creating your own apps etc. But it is once again
intellectual property of someone.
- Another issue is the actual protection of user data itself.
Currently the emulator is as open as it can be! If the phone is stolen
for example, some data could be really sensitive that can be stored in
the Phone SQLite database? Will there be any solutions how to restrict
access to the console level in the future that the user himself can
set and manage?

Possible solutions that I have come to are:
- hardcoding the copyrighted data into code
- using obfuscators to protect the code from some reverse engineering
- authenticating the app over Internet on the first use and creating
some MD5 checkfiles

I find those questions important! If you have similar doubts or you
could extend the list of those issues, we could try to improve those
questions together through a wider dialogue!



2. Problem with Spinner with an image and a text

I want to put in each row of a Spinner an ImageView and a TextView...
I tried to include in a LinearLayout this two objects and add to the
ArrayAdapter this LinearLayout but always emulator shows an error..

Somebody knows what con I do?

This is my source code:


public class mySpinner extends Activity {

private Bitmap imagen1;

private Spinner spinner;
private LinearLayout layout1= new LinearLayout(this);
private ImageView imv1 = new ImageView(this);
private TextView text1 = new TextView(this);

/** Called when the activity is first created. */
public void onCreate(Bundle icicle) {


private void OrganizationSpinner(){

//***I create a layout in XML with a LinearLayout (id:layout1) with an
ImageView and a TextView inside
spinner = (Spinner) this.findViewById(;
layout1 = (LinearLayout)this.findViewById(;

//**I dont know exactly what parameters I have to put in ArrayAdapter
ArrayAdapter<LinearLayout> adapter = new ArrayAdapter<LinearLayout>(
this, android.R.layout.simple_spinner_dropdown_item);





3. Wanted to know if we can write c++ based APPS for Android

4. Accessing different API.. (aside from android.jar)

5. running android on motorola A780

6. Add RelativeLayout in LinearLayout thru code

7. Changes not appearing in Android