User Services/Try FMD
Get Find My Device Working
To get fmd running with stage do the following:
Works with B2G 2.0 and 2.1 branches.
1. set fxa to use stage servers download this: https://gist.github.com/edmoz/5596162
$ chmod +x modPref.sh $ ./modPref.sh pull
edit prefs.js and add this to the bottom on it’s own line:
user_pref("identity.fxaccounts.auth.uri", "https://api-accounts.stage.mozaws.net/v1");
2. Run this
$ ./modPref.sh push prefs.js
3. on Flame, sign into Fxa, verify email if needed, the verify link should be to
https://accounts.stage.mozaws.net/v1/verify_email?…
Note: even if you have an existing account before, you may not have created one in the Stage Database. Just create it again.
4. sign into:
if you look in console i see and it correctly finds my location: "device:updated" "2731a65040a15a6080c6b48d4231b4d9" Object { hasPasscode: undefined, latitude: 37.xx, longitude: -122.xx, altitude: 0, located: true, time: Date 2014-06-20T21:48:46.000Z } "{"Latitude":37.xx,"Longitude":-122.23120187,"Altitude":0,"Time":1403300926000,"Cmd":{"t":{"la":37.xx,"lo":-122.xx,"ok":true,"ti":1.403300926e+12}}}" device.js:50
ring, lost mode, erase all work as expected.
End 2 End Test
FindMyDevice end to end test!. This is what it does:
- launches desktopB2G and uses marionette.js to sign into FXA and enable FMD, leaves window open
- launches webdriver to sign into FMD web site with the same FXA acct
- tells you if your phone was located withing 60 sec (can be changed)
steps to run:
Clone my repo/branch, create a new directory if you already have gaia
- git clone https://github.com/edmoz/gaia.git
$ cd gaia $ git checkout fmd_e2e
- download selenium stand alone and run it:
java -jar selenium-server-standalone-2.42.2.jar
- create a STAGE firefox account user
- on desktop go here: https://accounts.stage.mozaws.net , verify the acct with link in your email
- edit run_fmd.sh with your fxa user:password
- run
./run_fmd.sh
Note: if you get a python failure you may need to install selenium lib for python: pip install selenium
Here's the source code:
QA Flash Steps
clone this:
git clone https://github.com/Mozilla-TWQA/B2G-flash-tool
run
./auto_flash_from_pvt.sh -w -g -G
choose gaia+gecko
Debugging
Client side on device:
User Build
Enable Developer Menu:
- Check this box: Settings > Device Information > Developer Menu
- Then check the boxes for:
- Settings > Developer > Gaia debug traces
- You may be able to set this via pref: user_pref('browser.dom.window.dump.enabled', true);
- Settings > Developer > Geolocation output in ADB
- Then run this:
adb logcat | grep -e GEO -e findmydevice
- Enable adb access:
- Settings > Debugging via USB - set to 'ADB' or 'ADB and DevTools'
install adb on desktop then run
adb logcat
Engineering Build
Enabled verbose logging by enabling this:
- Settings > Developer > Gaia debug traces.
install adb then run
adb logcat
For the web app, open Tools > Web Developer > Web Console
Geolocation data will print to console.
Custom FMD Server
If you want to flash FMD app to use a specific server, follow these steps:
Note: i haven’t been able to figure out if this can be done at runtime editable file vs build then flash. I wasn’t able to find any files with the fmd endpoint URI
$ git clone https://github.com/mozilla-b2g/gaia.git $ cd gaia Edit /customization/findmydevice.json with the server you want to use. $ make reset-gaia
Test Servers
FMD uses 2 different apps, Firefox Accounts Settings/FirstTimeUse gecko level code. Which is what you use when you sign into firefox accounts. You can modify this endpoint by pushing user_pref onto your b2g device.
Find My Device - Settings has two endpoints: fxa-oauth and fmd app server which is in the Gaia layer. You can modify this endpoint by flashing a locally modified findmydevice.json Gaia to your phone.
Current 2.1 master src of truth:
- https://github.com/mozilla-b2g/gaia/blob/master/customization/findmydevice.json
- http://dxr.mozilla.org/mozilla-central/source/modules/libpref/src/init/all.js#4217
stable env (CURRENTLY TESTING AGAINST)
- web app: https://fmd.stage.mozaws.net
- b2g-FTU-fxa: must push gecko pref: user_pref("identity.fxaccounts.auth.uri", "https://api-accounts.stage.mozaws.net/v1");
- b2g-fmd-fxa-oauth: https://oauth.stage.mozaws.net/v1 (b2g default)
- b2g-fmd: https://fmd.stage.mozaws.net (b2g default)
dev env:
- web app: http://fmd.dev.mozaws.net/
- b2g-FTU-fxa: https://accounts.firefox.com/v1 (b2g default)
Must Flash Gaia: - https://github.com/mozilla-b2g/gaia/blob/master/customization/findmydevice.json
- b2g-fmd-fxa-oauth: https://oauth.accounts.firefox.com/v1
- b2g-fmd: http://fmd.dev.mozaws.net/
stage env:
- web app: https://find.stage.mozaws.net
- b2g-FTU-fxa: https://accounts.firefox.com/v1 (b2g default)
Must Flash Gaia: - https://github.com/mozilla-b2g/gaia/blob/master/customization/findmydevice.json
- b2g-fmd-fxa-oauth: https://oauth.accounts.firefox.com/v1
- b2g-fmd: https://find.stage.mozaws.net
prod env (untested)
- web app: https://find.firefox.com (ToBeDeployed)
- b2g-FTU-fxa: https://accounts.firefox.com/v1 (b2g default)
Must Flash Gaia as of now: - https://github.com/mozilla-b2g/gaia/blob/master/customization/findmydevice.json
- b2g-fmd-fxa-oauth: https://oauth.accounts.firefox.com/v1
- b2g-fmd: https://find.firefox.com