O
O
oeiua2011-12-26 14:12:40
satellite navigation
oeiua, 2011-12-26 14:12:40

Android: problem when running gps and gprs at the same time: the connection is broken?

When I receive GPS coordinates, the socket connection is broken. The same for wi-fi.

Reproducible on Samsung galaxy i9000(Android version: 2.3.4)
Not reproducible on phone: LG P500(Android version: 2.3.3)
Code to get coordinates (run in main thread):

private final long MIN_TIME = 60000;
private final long MIN_DISTANCE = 10;

_locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);

try {
_locationManager.requestLocationUpdates(
LocationManager.GPS_PROVIDER, MIN_TIME, MIN_DISTANCE, _gpsListener);
} catch (Exception e) {
System.out.println(e.toString());
}

Socket creation code (Run in a separate service):
_socket = new Socket();
_socket.setSoTimeout(200);
InetSocketAddress sockaddr = new InetSocketAddress(_ip, _port);
_socket.connect(sockaddr, 4000);

Someone faced a similar problem?
Is it related to the version of android or hardware?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question