Taking screenshots of your application can be useful in many circumstances, for example showing your work to a client, or when publishing your app on the Marketplace. This article explains how to take screenshots on your Firefox OS phone.
Note: Android developers will find this familiar: The steps are really similar.
Preparing your phone
- On your phone, go to the Developer Settings and check Remote Debugging & Console Enabled.
- Make sure you phone has ADB installed and working.
- Connect your phone to your computer via USB.
Taking a screenshot
You now have four choices: using the Terminal, using DDMS in Eclipse, using the dedicated button combination on the phone, or using the App Manager.
Terminal
Open a terminal window, then enter the follwing three commands:
- Take the screenshot using the following command (you can change
screenshot.png
if you want to call it something else):
adb shell screencap -p /sdcard/screenshot.png
- Pull the picture onto your computer:
adb pull /sdcard/screenshot.png
- Remove the screenshot from your device:
adb shell rm /sdcard/screenshot.png
Alternatively, you can use ffmpeg:
- Make sure you have ffmpeg installed:
- On Mac, if you use MacPorts, you can do this with
sudo port install ffmpeg
. For homebrew, dobrew install ffmpeg
. - On Linux (Ubuntu/Debian), useĀ
sudo apt-get install ffmpeg
.
- On Mac, if you use MacPorts, you can do this with
cd
into theB2G/gaia
directory.- Use the
make screenshot
command to take a screenshot. - You now have a screenshot called
screenshot.png
.
DDMS
Open Eclipse.
- Open DDMS: Window > Open Perspective > Other > DDMS.
- On the left side panel, in the Devices tab, click the Screen capture button.
- A new window appears with several options; click on Save button to save your screenshot.
Note: To learn more about DDMS, have a look at the DDMS documentation .
Phone button combination
- On Firefox OS versions up to 2.0, simultaneously hold down the Home and Power buttons for a few seconds.
- On Firefox OS version 2.1 and beyond, simultaneously hold down the Volume Down and Power buttons for a few seconds.
This takes a screenshot, which is saved in your Gallery. You can now copy the picture from your SDCard to your computer using whatever method suits you best.
Note: The button combination change was made because many people feel that Home and Power is more difficult to do that it should be, especially with one hand, plus devices with no hardware Home button are not very well supported (you can't use a software Home button in many places in Gaia, such as the lock screen).
App Manager/Simulator
- Go to the App Manager, connect to your phone, and navigate to the Device tab on the left.
- Click on the Screenshot button at the bottom of the page (is at the same place that you started the simulator).