The Mini Mobile Device Lab (MMDL) is a framework to help developers test pages across multiple devices, including phones, tablets, Desktops, etc. It works with Android, iOS, Windows (including phone, RT and desktop), and Chrome OS.
When a A URL is pushed, the devices will simultaneously open the page, allowing you to see how the page looks across each device. In addition, it will also run the page through services like PageSpeed Insights, Web Page Test, and check for specific open web features like HTTPS, Service Worker, Theme Color, and Web App Manifests.
A web front end is used to send URLs to Firebase, which acts as the back end, syncing URLs out to all of the connected devices.
Android: The Node client app running on a Raspberry Pi (or other computer) listens for new URLs and uses ADB to fire a browse intent, opening the URL on the device.
iOS & Windows: A native app receives URLs from Firebase and opens them in a WebView.
ChromeOS or Chrome Desktop: A Chrome Extension listens for new URLs sent from Firebase and opens a new tab or uses the existing tab to display the content.
init-data.json
rules.json
config.sample.js
to config.js
config.js
accordingly.
firebaseUrl
is the URL for your Firebase project.firebaseKey
is the api key for that Firebase project.If you want to test pages using PageSpeed Insights or WebPage Test, be sure to
get an API Key and update config.apiKeys
in Firebase with the appropriate key.
The server is used to control the looper, manage test execution, update Firebase with results tests and handle a few other functions. If you don’t want to use the looper or test pages, you can skip this section.
PreRequisites: Node (0.12.x), ADB
PiLab
folder, run npm install
config.sample.json
to config.json
.config.json
accordingly.
firebaseUrl
is the URL for your Firebase project.firebaseKey
is the api key for that Firebase project.frontEndUrl
is the URL for where you've hosted the PiLabFrontEnd.node server.js
.PreRequisites: Node (0.12.x), ADB
node client.js
PreRequisites: XCode & all of the other pre-reqs for building iOS apps
ViewController.m
, change fbAppName
to the Firebase App name you created earlierBecause there is no native Firebase SDK for Windows, we’ve used two WebViews to
control the experience. One WebView (wvListener
) listens for notifications
pushed via window.external.notify
, when a message is received, it sets the URL
of the second WebView (wvMain
) to the new URL.
PreRequisites: Visual Studio 2012 & all of the other pre-reqs for building Universal Windows Apps.
MainPage.xaml
for both MMDL-uni.Windows and MMDL-uni.WindowsPhone,
update the URL of <WebView x:Name="wvListener" Source="https://goog-mtv-device-lab.appspot.com/notify.html" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"></WebView>
to the PiLabFrontEnd URL you created earlier.Package.appxmanifest
for both MMDL-uni.Windows and MMDL-uni.WindowsPhone,
update the URL of <Rule Match="https://goog-mtv-device-lab.appspot.com/notify.html" Type="include" />
to the PiLabFrontEnd URL you created earlierOnce the devices have been setup, you can use the web front end to send URLs.
The simplest way is to use index.html
to send a single URL, it will pause the
looper for 3 minutes then automatically restart it. For more advanced control,
use admin.html
, which allows you to change the displays on different devices,
adjust the loop time, add or modify URLs in the loop, etc.
Raspberry Pi’s work well for controlling the Android devices or as the Server, and is how we set up the MMDL at Google IO 2015.
There are a few things to be aware of:
sudo
for proper functionality.If your Pi boots to the command line, you can automatically start the PiLab client (or server) with these steps.
sudo nano /etc/inittab
to edit the inittab
file1:2345:respawn:/sbin/getty 115200 tty1
and comment it out by
adding a #
at the beginning of the line.1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1
.nano
by pressing CTRL-X, followed by Y.profile
file and add ~/login.sh
to the end.~/login.sh
and add the following code:
cd ~/MiniMobDevLab
echo Starting PiLab in 5 seconds
sleep 5
./client.sh
~/login.sh
file executable by running chmod +x ~/login.sh
The Mini Mobile Device Lab is an open source project and we welcome your contributions! Before submitting a pull request, please review CONTRIBUTING.md and make sure that there is an issue filed describing the fix or new content. If you don't complete these steps, we won't be able to accept your pull request, sorry.