berlog / androzic

Automatically exported from code.google.com/p/androzic
0 stars 0 forks source link

Fix exceptions when running on device w/o GPS #229

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
It make full sense to run androzic on a device without GPS - to serve at least 
as map/waypoint/track viewer. Patch below fixes exceptions in background 
services which appear in such case. Tested on Nook Tablet.

diff -r a0f9f337da7d src/com/androzic/location/LocationService.java
--- a/src/com/androzic/location/LocationService.java    Mon Jan 23 15:59:45 2012 
+0400
+++ b/src/com/androzic/location/LocationService.java    Thu Feb 23 02:58:47 2012 
+0200
@@ -192,8 +192,12 @@
                locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
                Log.d("ANDROZIC", "LocationService: network provider set");
            }
-           locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, 
this);
-           Log.d("ANDROZIC", "LocationService: gps provider set");
+           try {
+               locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, 
this);
+               Log.d("ANDROZIC", "LocationService: gps provider set");
+           } catch (IllegalArgumentException e) {
+               Log.d("ANDROZIC", "LocationService: cannot set gps provider, likely no gps 
on device");
+           }
        }

        sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);

Original issue reported on code.google.com by pmis...@gmail.com on 23 Feb 2012 at 7:16

GoogleCodeExporter commented 8 years ago

Original comment by novikov on 29 Feb 2012 at 7:45

GoogleCodeExporter commented 8 years ago
Fixed in 1.5

Original comment by novikov on 11 Mar 2012 at 4:35

GoogleCodeExporter commented 8 years ago
Nice, thanks, any chance to see source code for 1.5 in the repo? Currently 
available 1.4 doesn't even compile: Issue 252

Original comment by pmis...@gmail.com on 3 May 2012 at 10:58