Monthly Archives: April 2014

Altimeter in MyTrails 2

In the past, I have resisted using the barometric pressure sensor present in most recent high-end phones for a variety of reasons:

  • there is no high-level Android API to reliably get altitude information (in particular I would have expected an API that processes data from all available sensors to mitigate the inaccuracy and drift of each)
  • without such an API, a manual calibration is required, which is intrusive (especially since it needs to be repeated at regular intervals)

I have finally let myself be convinced that the GPS altitude is a poor substitute (because it’s noisy and imprecise) for an altimeter, and I have done my best to make the calibration process as unobtrusive as possible.

If your device has a barometric pressure sensor, it will automatically try to record your pressure-derived altitude. Once the GPS has a fix, MyTrails will try to get sensible defaults to help calibrate the altimeter: it looks up the ambient temperature and altitude from an online service if you are connected, or it uses the GPS altitude and temperature from your phone if it has one.

It then creates a notification to ask you to perform the calibration; you don’t have to do it immediately, so you can wait until you reach an altitude sign or a reference altitude on the map. You can tweak the values (temperature is not too important) and calibrate. MyTrails will use the calibration to set altitudes based on already-recorded pressure data, and use until the next time you calibrate (MyTrails will remind you to update the calibration at regular intervals).

New stats have been added (and can be shown on the HUD), and the altimeter-derived altitude can be graphed.

I need to tweak how altitudes are stored in exported GPX, and used for calculations and colorization, so that when the altimeter is used when it is calibrated, but the GPS is used as a backup.

Calibrating the altimeter

Calibrating the altimeter

How can I use my external SD card for offline maps on KitKat or later?

One of the new “features” of Android 4.4 (KitKat) is that applications can no longer use the external SD card as a generic storage volume and read/write everywhere. There are valid security reasons for the change, but the way Google has done this breaks many apps and doesn’t provide a clear way to do things right for application developers.

In the case of MyTrails, it means that if you want to store your offline maps on your external SD card, you’ll have to jump through a few hoops:

  • If your device is rooted, you can use a free app like SDFix to revert to a fully-writable SD card
  • If your device is not rooted, there is only one folder that MyTrails can write to on the external SD card: /storage/sdcard1/Android/data/com.frogsparks.mytrails (this path may be slightly different if you’re using the preview version of MyTrails, or your device mounts the SD card to a different location within /storage; some devices use /storage/extSdCard/)

Please note the following caveats (if your device is not rooted):

  • you can not share the same offline maps between the official and preview versions of MyTrails
  • if you uninstall MyTrails, your offline maps will be deleted (this is by design, part of the reason Google make this change in KitKat), unless you use a privileged file manager (one that comes as part of your device’s default software) to move them beforehand