Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/03/2015, 03:21
Avatar de JairLizcano
JairLizcano
 
Fecha de Ingreso: junio-2008
Ubicación: Santander, Colombia
Mensajes: 608
Antigüedad: 15 años, 11 meses
Puntos: 53
Pregunta Problema en ciertos móviles con LocationManager

Buena noche, estoy desarrollando un aplicación móvil que requiere un servicio activo, dicho servicio envía cada determinados metros la ubicación al servidor con su respectivo usuario implementando la clase LocationManager.

Hasta el momento las pruebas se han realizado es móviles de la Gama Motorola G y X sin ningún problema. Pero... hay ciertos móviles de la gama Xperia que al iniciar la aplicación y ejecutarse dicho servicio cierra la app y llevo ya varios días revisando compatibilidad y aún no defino un problema como tal.

Comparto el método del servicio que está generando el problema:

Código:
	@Override
	public void onLocationChanged(Location location) {
		// TODO Auto-generated method stub
		
		try {
			
			if((location_manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) && (location_manager.isProviderEnabled(LocationManager.NETWORK_PROVIDER))) {
				
				if(request_counter == 0) {
					
					last_position = new LatLng(Double.parseDouble(location.convert(location.getLatitude(), location.FORMAT_DEGREES)), Double.parseDouble(location.convert(location.getLongitude(), location.FORMAT_DEGREES)));
				
					request_counter ++;
				} else {
					
					Location location_last_position = new Location("");
					location_last_position.setLatitude(last_position.latitude);
					location_last_position.setLongitude(last_position.longitude);
					
					Float distance = location_last_position.distanceTo(location);
					
					if(distance.intValue() >= getApplicationContext().getResources().getInteger(R.integer.distance_range)) {
						
						String send_position_url = String.format(getApplicationContext().getString(R.string.send_position_service), location.convert(location.getLatitude(), location.FORMAT_DEGREES), location.convert(location.getLongitude(), location.FORMAT_DEGREES), getEmail(getApplicationContext()), 2);
						
						SPR spr = new SPR();
						spr.execute(send_position_url);
						
						last_position = null;
						last_position = new LatLng(Double.parseDouble(location.convert(location.getLatitude(), location.FORMAT_DEGREES)), Double.parseDouble(location.convert(location.getLongitude(), location.FORMAT_DEGREES)));
					} else {}
				}
			} else {
				
				Toast.makeText(getApplicationContext(), getApplicationContext().getString(R.string.location_unabled), Toast.LENGTH_LONG).show();
			}
		} catch(Exception e) {
			
			Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show();
		}
	}
Quedo agradecido con cualquier idea del porqué o qué podría ser el problema.

Desde ya muchas gracias.
__________________
Programar dejó de ser una profesión acusada en la oscuridad y disfrutada fríamente... para convertirse en un arte.