简体   繁体   中英

Device to Device Communication in Android

I have been tasked for university to program a mobile phone application. I have oppted for two mobiles to communicate with each other via message.

I would like the application to connect the mobile to the internet to send the message and the other mobile to connect to the internet to recieve the message.

I am using Eclipse IDE.

Does anyone have any ideas for good examples of similar application source code so I can develop my application using appropriate protocols.

I would appreciate any advice and I am certainly not looking for someone to give me "the answer" I am really looking forward to getting stuck in. Though I have never touched an android phone let alone programed one. So some advice would be amazing!!

Thanks

Si

Before you determine the technical solution you need to figure out how any two devices that don't know about each other will communicate.

In your case, where you seem to be attempting to develop some kind of peer-to-peer solution you most probably will need some kind of server in between where your phones send messages to and poll for messages.

If you are using WIFI, you would have each phones IP address and could configure each phone to communicate with each other directly.

Once you determine your architecture then something simple like http may be enough to communicate.

You might check out What is Android? to get an idea of the frameworks/libraries that are available on Android. Reading the links in the left pane at that site lead you through a nice series of articles about Android.

In terms of ways for two devices to communicate, they are many and difficult to enumerate. In general you will have much better luck with specific questions here than you will with broad questions.

You might be interested in reading about C2DM for pushing messages to a device; if not, there are many other alternatives involving polling.

Get used to this site: http://developer.android.com/index.html Learn it, love it. It's full of useful information. The Videos section gives plenty of live talks about what exactly Android is among other topics. One of the first things you need to do is go to the SDK section. It gives a detailed guide on how to get setup. The Dev Guide is great for learning more about Android and how to program Android apps (not just Java programs) especially while just getting started. Resources is full of code examples and articles on specific issues and Reference is the entire platform documentation. @Matthew Willis has already given a helpful link from the Dev Guide.

Look around the site, download and install the SDK, and come back whenever you have any questions. Good Luck!

GCM CSS is probably your best bet

https://developer.android.com/google/gcm/ccs.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM