summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
24215a4)
On devices without GPS receivers, use network location instead of
crashing.
Signed-off-by: Keith Packard <keithp@keithp.com>
private void enable_location_updates() {
// Listen for GPS and Network position updates
LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
private void enable_location_updates() {
// Listen for GPS and Network position updates
LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
- locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 1, this);
- location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
+ if (locationManager != null)
+ {
+ try {
+ locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 1, this);
+ location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
+ } catch (Exception e) {
+ locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1000, 1, this);
+ location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
+ }
- if (location != null)
- AltosDebug.debug("Resume, location is %f,%f\n",
- location.getLatitude(),
- location.getLongitude());
+ if (location != null)
+ AltosDebug.debug("Resume, location is %f,%f\n",
+ location.getLatitude(),
+ location.getLongitude());
+ AltosDebug.debug("Failed to get GPS updates\n");
+ }
update_ui(telemetry_state, state, true);
}
update_ui(telemetry_state, state, true);
}
// Listen for GPS and Network position updates
LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
// Listen for GPS and Network position updates
LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
-
- locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 1, this);
+ try {
+ locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 1, this);
+ } catch (Exception e) {
+ locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1000, 1, this);
+ }
new AltosLaunchSites(this);
}
new AltosLaunchSites(this);
}
JAVA_RES=16 32 48 64 128 256
MAC_RES=16 32 128 256 512
WIN_RES=16 24 32 48 64 72 96 128 180 256
JAVA_RES=16 32 48 64 128 256
MAC_RES=16 32 128 256 512
WIN_RES=16 24 32 48 64 72 96 128 180 256
-RES=$(shell echo $(JAVA_RES) $(MAC_RES) $(WIN_RES) | awk '{ for (i = 1; i <= NF; i++) printf("%s\n", $$i); }' | sort -n -u)
+AMAZON_RES=114 512
+RES=$(shell echo $(JAVA_RES) $(MAC_RES) $(WIN_RES) $(AMAZON_RES)| awk '{ for (i = 1; i <= NF; i++) printf("%s\n", $$i); }' | sort -n -u)
# Application icon base names
# Application icon base names
JAVA_FILES = $(JAVA_AM_FILES) $(JAVA_MP_FILES) $(JAVA_TG_FILES)
JAVA_FILES = $(JAVA_AM_FILES) $(JAVA_MP_FILES) $(JAVA_TG_FILES)
+# Files needed for Amazon store
+
+AMAZON_FILES = $(shell for i in $(AMAZON_RES); do echo $(AM_NAME)-$$i.png; done)
+
# PNG files needed by anyone
AM_FILES = $(shell for i in $(RES); do echo $(AM_NAME)-$$i.png; done)
# PNG files needed by anyone
AM_FILES = $(shell for i in $(RES); do echo $(AM_NAME)-$$i.png; done)
fat: all $(ICO_FILES) $(ICNS_FILES) $(EXE_FILES)
fat: all $(ICO_FILES) $(ICNS_FILES) $(EXE_FILES)
-all-local: $(JAVA_FILES) $(AM_XPM) $(LED_ICONS)
+all-local: $(JAVA_FILES) $(AM_XPM) $(LED_ICONS) $(AMAZON_FILES)
clean-local:
$(RM) $(AM_NAME)-*.png $(TG_NAME)-*.png $(MP_NAME)-*.png
clean-local:
$(RM) $(AM_NAME)-*.png $(TG_NAME)-*.png $(MP_NAME)-*.png