Search | Sailfish OS | Running | PineTime | All Posts

Speeding up GPS fix on SailfishOS

January 23, 2021 — Nico Cartron

This post explains how to keep using Mozilla Location Services (MLS) on SailfishOS, therefore speeding up GPS fix, especially useful on Sony Xperia XA2.


Why ?

This post explained how to use Yandex services to replace Mozilla Location Services, who can't be used anymore. I concluded it by stating that I didn't see a real improvement on GPS fix speed time.

In this article, I want to show you how it is possible to use MLS and improve that situation.

General idea

Let's start by giving credit to the user cbalanescu who explained the whole thing in this post.

He explains in a clear manner why we can use this solution:

In fact Mozilla Location Service is not disabled. Mozilla requires a strong reason to request an API key to directly use their services.
However, Mozilla Location Services data can still be used in “offline” mode and not by accessing directly the data.

In a nutshell, the idea is to:

  • download the full cellular data from MLS (CSV file),
  • unzip the CSV,
  • convert this CSV to a format the phone can understand,
  • move the files to the relevant location.

Details

Prerequisites

  • You'll need to install the mlsdbtool, which you can get either:
    • from this GH project,
    • or by installing it from the terminal with devel-su pkcon install geoclue-provider-mlsdb-tool
  • I am assuming you have SSH access to your SFOS phone, since the commands will be launched from the phone, over SSH.

Install steps

  1. Download the full cell data from https://location.services.mozilla.com/downloads 34

    devel-su
    cd ~defaultuser/Downloads // or cd ~nemo/Downloads if you used SFOS before 3.4
    curl -O https://d2koia3g127518.cloudfront.net/export/MLS-full-cell-export-2021-01-23T000000.csv.gz

    (Replace with the latest link in "Full Cell Exports")

  2. Extract the CSV:

    gunzip MLS-full-cell-export-<DATE>.csv.gz

    (Replace with the correct one of the file)

  3. Use mlsdbtool against the CSV file:

    geoclue-mlsdb-tool -c <country> <CSV_Filename.csv>

    If you don't know your country code (MCC), look it up here.
    For instance, I am located in France, so I am using France as country.

    Alternatively, you can use devel-su geoclue-mlsdb-tool --help country which will list all the countries; just use the first column to pick your country name.

    It will create 9 folders containing each of them a mlsdb.data file:

  4. Move the folders to /usr/share/geoclue-provider-mlsdb/

You will now have the location calculated based on the triangulation against the cell towers in your area while you have the data link off.

/!\ You still need GSM connection so that the Cell ID could be acquired.

Also, you have to use the "high precision" location in Settings > Location.

Did that work for you? Let me know on Twitter


Tags: SailfishOS


I don't have any commenting system, but email me (nicolas at ncartron dot org) your comments!
If you like my work, you can buy me a coffee!