10435

how to send and receive image through socket

Question:

I want to send an image from one android device to one or multiple android devices. so which mechanism i should follow to send the image from one android device to another android device. I am new to android. so if possible then give me logic(way to complete the task). and if possible then give example of it..

Answer1:

Take a look at the WiFiDirectDemo sample in the SDK (API level 14+). It does exactly what you are looking for: <a href="http://developer.android.com/resources/samples/WiFiDirectDemo/index.html" rel="nofollow">http://developer.android.com/resources/samples/WiFiDirectDemo/index.html</a>

WiFi direct is only available for devices running ICS. However, the socket server/client code is generic and reusable over Wifi network also:

Client: <a href="http://developer.android.com/resources/samples/WiFiDirectDemo/src/com/example/android/wifidirect/FileTransferService.html" rel="nofollow">http://developer.android.com/resources/samples/WiFiDirectDemo/src/com/example/android/wifidirect/FileTransferService.html</a>

Server: <a href="http://developer.android.com/resources/samples/WiFiDirectDemo/src/com/example/android/wifidirect/DeviceDetailFragment.html" rel="nofollow">http://developer.android.com/resources/samples/WiFiDirectDemo/src/com/example/android/wifidirect/DeviceDetailFragment.html</a> FileServerAsyncTask.

Recommend

  • What is the equivalent of Android permissions in iOS development? [duplicate]
  • jersey/tomcat Description The origin server did not find a current representation for the target res
  • Magento get URL before current
  • Prevent Tomcat from caching request during starup
  • Bash if statement with multiple conditions
  • Reading a file into a multidimensional array
  • How do I signal completion of my dataflow?
  • converting text file into xml using php?
  • Does Mobilefirst provide a provision to access web services directly?
  • Android application: how to use the camera and grab the image bytes?
  • JBoss External Properties Files in Classpath
  • How to revert to previous XCode version?
  • Unable to get column index with table.getColumn method using custom table Model
  • How to use JavaScript to determine whether a file exists in a directory?
  • custom UITableViewCell with image for highlighting
  • Get history of file changes from TFS to implement custom “blame”-behaviour of exceptions
  • Create DicomImage from scratch using Dcmtk
  • Installed module is empty
  • How to get Eclipse Oxygen to run on Java 9
  • How to attach a node.js readable stream to a Sendgrid email?
  • How to clear text inside text field when radio button is select
  • Asynchronous UI Testing in Xcode With Swift
  • Scrapy recursive link crawler
  • If I include Java 8 in my Android app does that affect which devices it will work on?
  • Control modification in presentation layer
  • Why is an OPTIONS request sent to the server?
  • Get object from AWS S3 as a stream
  • Can Jackson SerializationFeature be overridden per field or class?
  • Redux, normalised entities and lodash merge
  • Hazelcast - OperationTimeoutException
  • RestKit - RKRequestDelegate does not exist
  • bootstrap to use multiple ng-app
  • How to get icons for entities from eclipse?
  • Android Studio and gradle
  • Revoking OAuth Access Token Results in 404 Not Found
  • Turn off referential integrity in Derby? is it possible?
  • How does Linux kernel interrupt the application?
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • JaxB to read class hierarchy
  • How to get NHibernate ISession to cache entity not retrieved by primary key