Is it possible to pass Socket/FileDescriptor from one activity to other activity in other application? I tried using Intent but got
java.lang.IllegalArgumentException: File descriptors passed in Intent
Please help!
Is it possible to pass Socket/FileDescriptor from one activity to other activity in other application? I tried using Intent but got
java.lang.IllegalArgumentException: File descriptors passed in Intent
Please help!
Sure you can - using content providers. Yo have to create your own content provider and override its method openFile. Read here, for instance: http://www.grokkingandroid.com/handling-binary-data-with-contentproviders/
The short answer is: probably no, but...
Activity in the other application run in the other process. I believe, there is no ability to pass Socket or FileDescriptor from one process to another - neither in Java nor in Android. But it's possible in Linux using UNIX sockets and SCM_RIGHTS: man unix(7), cmsg(3). Since Android is based on Linux kernel, probably you can write this functionality in C and pass it to your Java code with JNI (see Android NDK). Possibly, you also have to implement your own versions of Socket and FileDescriptor. Summing up, I think you really don't want to do it all. Probably the best way - to review your task and find another, simpler solution.
Just in case: inside the one application you can reuse Sockets and FileDescriptors freely. For example, using static members and some kind of synchronization Intents.
Check http://stackoverflow.com/questions/14413810/sharing-file-descriptor-using-android-binder. – videoguy Feb 21 '14 at 00:16