-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Sending and Receiving Data with Sockets
Read about sockets generally on the Oracle Sockets Tutorial.
(Needs Attention)
We need a way to send data to a computer from our android device. Easiest way is given the local ip address of the computer on the network to simply send data via a socket:
- http://android-er.blogspot.com/2011/01/simple-communication-using.html - Guide to sending data via a socket
- http://stackoverflow.com/a/20131985/313399 - stackoverflow snippet which connects to a host, and can send data to it via an asynctask
- http://stackoverflow.com/questions/6309201/sending-tcp-data-from-android-as-client-no-data-being-sent - stackoverflow snippet sending data to an ip address via a socket
- http://thinkandroid.wordpress.com/2010/03/27/incorporating-socket-programming-into-your-applications/ (client piece is phone, server piece needs to be on computer)
To send messages between an Android phone and a computer, the computer needs to be running a program that listens for messages sent on the socket coming from the phone:
Created by CodePath with much help from the community. Contributed content licensed under cc-wiki with attribution required. You are free to remix and reuse, as long as you attribute and use a similar license.
Finding these guides helpful?
We need help from the broader community to improve these guides, add new topics and keep the topics up-to-date. See our contribution guidelines here and our topic issues list for great ways to help out.
Check these same guides through our standalone viewer for a better browsing experience and an improved search. Follow us on twitter @codepath for access to more useful Android development resources.