My app crashes when I try to get my location on a samsung galaxy s3. It works perfect on 3 other phones that I have tested. I just have remote testers on the samsung galaxy s3 so I can't get the error message. Here's my code:
Location finalLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
locationManager.removeUpdates(locationListenerGps);
locationManager.removeUpdates(locationListenerNetwork);
Location net_loc=null, gps_loc=null;
if(locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER))
gps_loc=locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if(locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER))
net_loc=locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
//if there are both values use the latest one
if(gps_loc!=null && net_loc!=null){
if(gps_loc.getTime()>net_loc.getTime())
finalLocation = gps_loc;
else
finalLocation = net_loc;
}
if(gps_loc!=null){
finalLocation = gps_loc;
}
if(net_loc!=null){
finalLocation = net_loc;
}