Android :: Connecting Two Devices Via TCP Sockets
Jul 9, 2010
I've been trying to connect two Android devices (2.1) via TCP sockets.
The vital part of the code:
Server:
ServerSocket serverSocket = new ServerSocket(SERVERPORT);
Client:
Socket socket = new Socket(serverAddr, SERVERPORT);
The weird thing is I can make it work if the client is an emulator, but the same code fails if running both of them on real devices.
The failure in the client side is:
CODE:................
I tried with WIFI and mobile net too, they were in the same subnet both times, INTERNET permission is given, the server is addressed through its real 192.168.. IP. I am planning to change the socket implementation with setCustomSocketImplFactory(). The problem is crucial in the process of implementing MSRP protocol to Android.
View 1 Replies
May 4, 2010
I'm looking to create a button in my app that essentially does the same thing as if a user went to "Settings"->"Wireless & Networks"- >"Bluetooth settings" and opted to connect (or disconnect) to a
View 7 Replies
View Related
Jun 26, 2010
Got the phone, all bluetooth working just fine. Then my 2010 Jetta won't stay paired. Tried soft rest. Tried taking out battery. looked for updates. the best I get is a 5 sec connection and then disconnects. Now my ear bud wont stay connected ether. Any thoughts?
View 9 Replies
View Related
May 29, 2010
My gf's computer is going south, but all she really does is go online. If I were to find a way to connect her Evo to a monitor (this should be easy with and HDMI cable, right?), a mouse (bluetooth?), and a keyboard (can you do two bluetooth devices at the same time?), she'd be able to essentially have a computer when she docks her phone to all this, right?
But, does Andoid have an app and Evo the capability to bluetooth to a mouse and keyboard and is the HDMI cable the way to go to get the display on a spare monitor, or could I use the USB? Just thinking out loud here. Cell phone processors are fast enough to handle internet browsing and emailing, which is pretty much all she does, and the speed of the connection (we're in a 4G area) would make downloads fast. How could it be done?
View 15 Replies
View Related
May 1, 2010
For my app, I need to record audio from MIC on an Android phone, and send it over TCP to the other android phone, where it needs to be played. I am using AudioRecord and AudioTrack class. This works great with a file - write audio to the file using DataOutputStream, and read from it using DataInputStream. However, if I obtain the same stream from a socket instead of a File, and try writing to it, I get an exception. I am at a loss to understand what could possibly be going wrong.
This is the code:.................
View 2 Replies
View Related
Sep 24, 2013
I am trying to implement basic Datagram Sockets in Android. I am starting with one of the samples available on the web:
Code:
String messageStr="Hello Android!";
int server_port = 54372;
try {
[code].....
The program dies when it hits the s.send(p) command.
View 2 Replies
View Related
Sep 20, 2010
In iPhone there is Cocoa Asynchronous socket library. Is there a similar library in Java for Android? Can it be done using Java Asynchronous sockets(NIO library) or is there a way I can make use of NDK for Android and use native libraries for asynchronous sockets?
View 1 Replies
View Related
Jun 6, 2009
An application I'm working on stopped being usable after upgrading to 1.5, and the reason seems to be that, after joining a WiFi network and creating a TCP/IP or UDP/IP socket, there is no way to communicate using it from a remote entity. I can not even ping the phone using the normal ping command, which was possible using 1.0. This affects my program since it's using mDNS/DNS-SD and peer-to-peer TCP sockets for communication. Is there anyone else who can confirm this?I have tried running the program built with SDK 1.0 and SDK 1.5 while running on a real phone running Android 1.5 and the problem is still the same.
View 2 Replies
View Related
May 30, 2010
I have an Android activity which in turn starts a thread. In the thread I open a persistent TCP socket connection. When the socket connects to the server dynamic data is downloaded. The thread sends messages using Handler-class to the activity when data has been received. Now if the user happens to switch from portrait to landscape mode the activity gets an onDestroy call. At this moment I close the socket and stop the thread. When Android has switched landscape mode it calls onCreate yet again and I have to do a socket re-connect. Also, all of the data the activity received needs to be downloaded once more because the server does not have the ability to know what has been sent before, i.e. there is no "resume" feature.
Thus the problem is that there is alot of data which is resent all the time when landscape mode is changed. What are my options here? Should I create a service which handles the socket traffic towards the server thus I always got all the data which the server has sent in the service. Or should I disable landscape mode all together perhaps? Or would my best bet be to rewrite my server which is a VERY BIG job
View 1 Replies
View Related
Nov 19, 2009
I would like to simulate a small cluster of Android devices either on one laptop (worst-case), or on several machines on a private network. This is for testing communications and process migration on Android.
Is there a safe way to identify and launch a particular emulator from a given application under Eclipse? I have a recent Eclipse/Java/ADT setup and I'm using the a variety of tutorials from Mark Murphy, Meier, and Abelson.
View 1 Replies
View Related
May 22, 2012
Is it possible to write a in-app openvpn connection (via streams and sockets)? If it is, then is there any android application which managed that already? I have also problems finding in-depth openvpn protocol description.
View 4 Replies
View Related
May 14, 2014
How To Transfer TEXT MESSAGES from WP8.1 devices to Android Devices ??And also the contacts!!
View 2 Replies
View Related
Jul 16, 2010
I have a self signed server certificate (cert.pem) and need to enable it for SSL sockets in an Android application. Ideally I'd like to package the code as .jar file and not need an external certificate file (i.e. include it into the code). With this code I can accept all certificates, which is not what I want: SSLContext sc = SSLContext.getInstance("TLS"); sc.init(null, new TrustManager [] { new MyTrustManager() }, new SecureRandom());
Do I need to add the certificate to a custom KeyManager or the custom TrustManager? One problem I've encountered is that Android does not accept JKS keystores (KeyStore.getDefaultType() returns "BKS"): "java.security.KeyStoreException: KeyStore JKS implementation not found"
View 1 Replies
View Related
Oct 2, 2013
Can I have two separate google play accounts for two different devices & keep one gmail account for both devices?
View 6 Replies
View Related
Nov 1, 2009
I am developing my am on mac (10.5.8), on eclipse and SDK 1.6 and a Vodafone HTC Magic Everything was working ok up to a few days ago. I can not see my device on adb devices. I also got a Sony Xperia and I can not see it on the list either. I upgraded the phone software (the HTC) to 1.6 a few days ago. Maybe that is what caused the change, but I could not be sure.
View 2 Replies
View Related
May 6, 2010
I have a widcomm example BluChat "WIDCOMM SDK RFComm Service" running on my PC with an USB dongle (BT-2400P). I would like to connect this chat from my HTC Desire. So I stared with the Java example http://developer.android.com/resources/samples/BluetoothChat/index.html. This is also using BT RFComm. If I'm using my HTC as a server it work's fine, but I would like to use my PC as a server. Then .connect() comes back with "Service Discovery Failure".
I have modified the UUID string in the Java example to match the PC-application
CODE:............
View 2 Replies
View Related
Jul 28, 2010
I got a code for connecting the web page but it shows always
"Connection failed; Host is unresolved: www.streetcar.org:80" The code is as follows. package myapp.httpdwnd;
import android.app.Activity;
import java.io.InputStream;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
View 3 Replies
View Related
Feb 5, 2010
I am developing the android application. which is going to update the content from android to the web(php webservice). Can anyone give me the sample code for my reference.
View 4 Replies
View Related
Apr 7, 2010
Is there any way to start/enable the internet through Wifi/GPRS/EDGE/UMTS from my android application?
View 3 Replies
View Related
Apr 7, 2010
Is there any way to start the internet through Wifi/GPRS/EDGE/UMTS from application?
View 4 Replies
View Related
Apr 11, 2010
I tried many different ways to connect to this url link but android keeps crashing saying the stack is corrupted, take a look. If anyone got the time on their hands to give it a try or give me some tips would appreciate it! :) Link does work try it on winamp or some music app...
Log Output: 04-11 10:30:17.908: DEBUG/dalvikvm(15329): [ 04-11 10:30:20.119 15329:0x3beb F/unknown ] 04-11 10:30:17.908: DEBUG/dalvikvm(15329): stack corruption detected: aborted / Used code to connect: URLConnection cn = null; URL url = new URL(_url); cn = url.openConnection(); // after openConnection() it crashes
View 5 Replies
View Related
Mar 24, 2009
I am trying to build an application on android which retrives data from a web server, im using my localhost for the webservices. i have developed jsp page to generate the data and pass to the android app. the data is in xml format.
In the andorid app i keep getting a socket exception while trying to open http connection using local host and the url includes jsp file and http post parameters. i have set the permission in the manifest file, still no luck.
Below are my codes, im sure im missing something somewhere.
CODE:................
View 4 Replies
View Related
Sep 2, 2010
I am developing a final year location-based project(gps) in android.I have to create a server using php and mysql which contains name and location(in latitude and longitude) of important hospitals in Mumbai.The android client should be able to retrieve the the latitude and longitude of locations in mysql(external) database and then plot it on a google map.
View 3 Replies
View Related
Jun 26, 2009
I have to connect to a webserver from android and i have to access a webservice and a webpage from the webserver.Anybody can help me.Please give step by step process with some code snippets because i am new to android and i dont know anything in connecting to a webserver.
View 2 Replies
View Related
Aug 22, 2010
I'm working on a service that collect data from sensor and save a fast fourier trasform in to the db, but when i press the red phone button (to make the screen black) it don't save anything. Any idea?
In addition i noticed that when i stop the service, it continues to read sensors, how should I do?
This is the code that i use to connect and start the service:
CODE:......
And this is my Service (public recClass recc; is the class that manage the db):
CODE:....................
View 1 Replies
View Related
Sep 2, 2010
I am developing a final year location-based project(gps) in android.I have to create a server using php and mysql which contains name and location(in latitude and longitude) of important hospitals in Mumbai.The android client should be able to retrieve the the latitude and longitude of locations in mysql(external) database and then plot it on a google map.
View 4 Replies
View Related
Nov 16, 2010
I have searched SO for anser to my question which is "invocking a remote webservice from a j2me application". All the tutorials refer to implementing it as a MIDLET. But I am not using a midlet. Can anyone please tell me if it is possible to invoke a webservice in plain j2me application, which is as basic as a hello world?
I am coding for android. My code starts with somethig like
CODE:..........
I want to know if a webservice can be invoked from this kind of program?
View 1 Replies
View Related
Jul 24, 2010
I got a Droid X for development, and after setting it up just like all my other test devices, it showed nothing when I ran "adb devices". When I plugged it in each time, OS X complained that it could not connect to the mass storage device. How can I fix this, and connect my Droid X to OS X for development?
View 2 Replies
View Related
Apr 10, 2013
I'm trying to connect my Android app to a PC server using Socket. Unforunately, the PC server doesn't receive any connection request from the app (there's no connection between them). I'm running the app in android emulator.
I've seen many tutorials and discussions in the internet about this problem and I fellow them literally, but still having the same problem that I mentioned above. the android app is running on eclipse emulator and the PC server on netbeans
the PC server source code:
public class server{
ServerSocket server;
public server() {
try
[code]...
View 2 Replies
View Related
Sep 7, 2010
What about handheld devices (PDAs, Smartphones, etc)? For Windows Mobile devices, there is SecureW2 for Windows Mobile. For iPhone, see our iPhone Web page. Currently, we know of no method for connecting Palm, Blackberry, or Nokia devices that are not running Windows Mobile to the UIC-Wireless network.
View 2 Replies
View Related