Making geolocation work on Geeksphone devices

This post is written for my own reference, in order to document the steps for getting geolocation working on Geeksphone phones.

For a long time, an easy way to get access to a Firefox OS phone was to order a Peak or Keon model from Geeksphone. The phone maker jumped on the Firefox OS train early on, offering reasonably priced phones aimed to early adopters.

These early adopters were in for a disappointing and frustrating surprise, as they would find out that geolocation didn’t work or work haphazardly at best. Such a problem is ridiculous for smartphones sold in 2013, but since those were “developer preview” devices, people didn’t complain too much about it.

Fast-forward to 2014. Geeksphone is now selling the Revolution model—a pretty good and powerful phone—aimed to end users, but to those users dismay it still has the same geolocation problems. Because I want to eat my own dog food, I am now using the Revolution as my personal phone and the lack of geolocation has been an enormous frustration.

So, I set out to either make GPS work on my phone or to go back to my trusty iPhone and wait for another phone maker to come up with a Firefox OS compatible phone that matched the Revolution specs.

After looking at many different sources and thanks to some good pointers from Fernando Jiménez and Francisco Jordano, I managed to make it work. Kind of. The hardware to make geolocation possible is definitely there, and the problem looks like it is a configuration one.

I documented below the steps that made geolocation work for me on the Geeksphone Revolution:

Configuration steps

Connect your phone to the computer, open a terminal and make sure you can see the phone using adb:

$ adb devices List of devices attached FC7C80DF device

Retrieve the following files using adb pull:

$ adb pull /system/b2g/defaults/pref/user.js 
$ adb pull /etc/gps.conf


Change (or add) the properties geo.gps.supl_server and geo.gps.supl_port in user.js to user Google’s GPS server. My user.js file looks like this:

pref('browser.manifestURL', "app://"); pref('browser.homescreenURL', "app://"); pref('network.http.max-connections-per-server', 15); pref('dom.mozInputMethod.enabled', true); pref('ril.debugging.enabled', false); pref('dom.mms.version', 17); pref('b2g.wifi.allow_unsafe_wpa_eap', true); pref('network.dns.localDomains', ",,,,,,,,,,,,,,,,,,,,,,,"); pref("app.update.url", ""); pref("geo.gps.supl_server", ""); pref("geo.gps.supl_port", 7276); pref("", "firefoxmarket"); pref("dom.payment.provider.0.description", ""); pref("dom.payment.provider.0.uri", ""); pref("dom.payment.provider.0.type", "mozilla/payments/pay/v1"); pref("dom.payment.provider.0.requestMethod", "GET");


Replace the contents in gps.conf with the following ones. I got to this particular configuration after looking into different sources, and adapted it to my needs (the NTP server is the Dutch one, for example). I wrote comments to clarify some settings.

# Change Country and Region! see AGPS= XTRA_SERVER_1= XTRA_SERVER_2= XTRA_SERVER_3= DEFAULT_AGPS_ENABLE=TRUE DEFAULT_USER_PLANE=TRUE DEFAULT_SSL_ENABLE=FALSE REPORT_POSITION_USE_SUPL_REFLOC=1 QOS_ACCURACY=50 QOS_TIME_OUT_STANDALONE=80 QOS_TIME_OUT_AGPS=95 QosHorizontalThreshold=1000 QosVerticalThreshold=500 AssistMethodType=1 AgpsUse=1 AgpsMtConf=0 AgpsMtResponseType=1 AgpsServerType=1 AgpsServerIp=3232235555 # Intermediate position report, 1=enable, 0=disable INTERMEDIATE_POS=1 # Accuracy threshold for intermediate positions # less accurate positions are ignored, 0 for passing all positions ACCURACY_THRES=3000 C2K_PORT=1234 ### AGPS server settings for Google ### SUPL_PORT=7276 SUPL_SECURE_PORT=7278 SUPL_NO_SECURE_PORT=3425 SUPL_TLS_HOST=FQDN SUPL_TLS_CERT=/etc/SuplRootCert # Carrier tags used universally in GPS configs CURRENT_CARRIER=common # Indoor Positioning Settings # 0: QUIPC disabled, 1: QUIPC enabled, 2: forced QUIPC only QUIPC_ENABLED=1 #Use WiFi 1=”On”, 0=”Off” ENABLE_WIPER=1

Now, since Google uses a GeoTrust certificate (you can check doing openssl s_client -connect in the terminal), we need to retrieve it and generate the root certificate we will use in our phone:

$ wget
$ openssl x509 -inform PEM -in GeoTrust_Global_CA.pem -outform DER -out SuplRootCert

Finally we need to upload all the files we modified into the device and reboot it:

$ adb remount
$ adb push user.js /system/b2g/defaults/pref/user.js
$ adb push gps.conf /etc/gps.conf
$ adb push SuplRootCert /etc/SuplRootCert
$ adb reboot

After doing this my geolocation worked, even indoors. It still takes some seconds to retrieve the AGPS fix and sometimes doesn’t get it immediately, but I can say that it works well enough to not drive me mad. Good luck!


How to create a SuplRootCert for
Bug 955880 - [GPS] GPS is not working anymore
Bug 908151 - [Geeksphone][GPS] Speedup Geolocation response time, currently takes about 10 minutes
Forum: How can I enable A-GPS on my Peak?``