1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
---
title: Simulador do Firefox OS
slug: Archive/B2G_OS/Simulator
tags:
- Aplicações
- Ferramentas
- Firefox OS
translation_of: Archive/B2G_OS/Simulator
---
<div class="note">
<p>Esta página descreve o Simulador do Firefox OS para os programadores que segmentam o Firefox OS 1.2 ou superior. Se está a desenvolver aplicações para o Firefox OS 1.1, em vez disso, consulte a documentação do <a href="/en-US/docs/Tools/Firefox_OS_1.1_Simulator">Firefox OS 1.1 Simulator</a>.</p>
</div>
<p><span style="line-height: 1.5;">The Firefox OS Simulator is <span style="line-height: 1.5;">a version of the higher layers of Firefox OS</span> that simulates a Firefox OS device, but runs on the desktop</span><span style="line-height: 1.5;">. This means that in many cases, you don't need a real device to test and debug your app. </span><span style="line-height: 1.5;">It runs in a window the same size as a Firefox OS device, includes the Firefox OS user interface and built-in apps, and simulates many of the Firefox OS device APIs.</span></p>
<p><span style="line-height: 1.5;">The Simulator is packaged and distributed as a Firefox add-on. Once you've downloaded it and installed it in Firefox, you can run it, push apps to it, and attach the developer tools to it using the <a href="/en-US/Firefox_OS/Using_the_App_Manager">App Manager</a> tool or </span><a href="/docs/Tools/WebIDE"><span style="line-height: 1.5;">WebIDE</span></a><span style="line-height: 1.5;">.</span></p>
<h2 id="Instalação"><span style="line-height: 1.5;">Instalação</span></h2>
<p><span style="line-height: 1.5;">To install the simulator, use <a href="/docs/Tools/WebIDE/Setting_up_runtimes#Adding_a_Simulator">WebIDE's Manage Extra Components pane</a> (available as part of Firefox 34 and onwards). Multiple versions are available, and you are advised to install them all, for maximum flexibility.</span></p>
<div class="note">
<p><span style="line-height: 1.5;">Starting with Firefox 43, the about:addons page may display warnings about your addon being unsigned. The simulators are properly signed at install time, however they are subsequently modified and thus appear "broken". They will continue to run successfully despite this warning message. Details are in {{ Bug(1197262) }}.</span></p>
</div>
<p>To start the Simulator, you choose it from WebIDE's runtime list. For more details, see the <a href="/docs/Tools/WebIDE/Setting_up_runtimes#Selecting_a_runtime" style="font-size: 14px; font-weight: normal; line-height: 1.5;">instructions in the WebIDE documentation</a>. Once the Simulator's running, you can push apps to it and debug them using the WebIDE, just as you can with a real device.</p>
<p>If you are using the <a href="/Firefox_OS/Using_the_App_Manager">App Manager</a> (an older tool available prior to the WebIDE), you can install a simulator via the following button:</p>
<p><a href="https://ftp.mozilla.org/pub/mozilla.org/labs/fxos-simulator/" style="margin-bottom: 20px; padding: 10px; color: white; text-align: center; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; display: inline-block; background-color: rgb(129, 188, 46); white-space: nowrap; text-shadow: rgba(0, 0, 0, 0.247059) 0px 1px 0px; box-shadow: rgba(0, 0, 0, 0.2) 0px 1px 0px 0px, rgba(0, 0, 0, 0.298039) 0px -1px 0px 0px inset;">Instalar Simulador</a></p>
<h2 id="A_IU_do_Simulador" style="line-height: 30px;">A IU do Simulador</h2>
<p><span style="line-height: 22.00800132751465px;">The Simulator appears as a separate window, sized so the simulated screen area is 320x480 pixels. </span><span style="line-height: 22.00800132751465px;">To simulate touch events you can click the mouse button and drag while holding the button down. So by clicking and dragging right-to-left from the Home Screen, you'll see the built-in apps, as well as any apps you have added:</span></p>
<p><img alt="" src="https://mdn.mozillademos.org/files/7173/simulator-1.2.png" style="display: block; height: 623px; margin: 0px auto; width: 810px;"></p>
<p>The Simulator has two buttons in a toolbar at the bottom:</p>
<ul>
<li>the button on the left takes you to the Home screen, or switches the Simulator off if you hold it down</li>
<li>the button on the right switches the Simulator between portrait and landscape orientation. This will generate the <a href="https://developer.mozilla.org/en-US/docs/WebAPI/Managing_screen_orientation#Listening_orientation_change" title="/en-US/docs/WebAPI/Detecting_device_orientation">orientationchange</a> event.</li>
</ul>
<h2 id="Emulação_do_cartão_SD">Emulação do cartão SD</h2>
<p>In the Simulator the device SD card is mapped to the "fake-sdcard" directory in the Simulator's profile, which is itself located inside the "extensions" directory under the Firefox profile in which the Simulator is installed. For example:</p>
<pre>/path/to/Firefox/Profiles/Firefox-profile-name/extensions/fxos_2_2_simulator@mozilla.org/profile/fake-sdcard</pre>
<p>Files read or written using the <code><a href="/en-US/docs/Web/API/Navigator.getDeviceStorage">getDeviceStorage</a></code> API will appear here.</p>
<p>Before version 2.2 of the Simulator, you had to create the "fake-sdcard" directory manually for this to work. From 2.2 onwards, the "fake-sdcard" directory is created for you automatically.</p>
<p>Also from version 2.2 onwards, if you're running the Simulator from the command line you can define a different directory by passing the <code>--storage-path</code> option.</p>
<div class="note"><strong>Note:</strong> this is mostly meant for API testing. Music will be read not from the "fake-sdcard" directory, but from your system's <code>~/Music</code>, pictures from <code>~/Pictures</code>, videos from <code>~/Videos</code>. Downloads go to <code>~/Downloads</code>. user-dirs.dirs redefinitions are supported.</div>
<h2 id="Limitações_do_Simulador">Limitações do Simulador</h2>
<p>Note that the Firefox OS Simulator isn't a perfect simulation.</p>
<h3 id="Limitações_do_Hardware">Limitações do Hardware</h3>
<p>Apart from screen size, the Simulator does not simulate the hardware limitations of a Firefox OS device such as available memory or CPU speed.</p>
<h3 id="Codecs_de_áudiovídeo">Codecs de áudio/vídeo</h3>
<p>The following codecs depend on hardware-accelerated decoding and are therefore not yet supported:</p>
<ul>
<li>MP3</li>
<li>AAC</li>
<li>H.264 (MP4)</li>
<li>WebM</li>
</ul>
<p>This means it isn't possible to use the Simulator to test video playback in apps and on websites like Youtube that rely on these codecs.</p>
<h3 id="APIs_Não_Suportadas"><a name="Unsupported-APIs">APIs Não Suportadas</a></h3>
<p>Certain APIs that work on the device won't work on the Simulator, generally because the supporting hardware is not available on the desktop. We've implemented simulations for some APIs such as geolocation, and expect to add more in future releases. However, at the moment the following APIs are not supported. Using them might throw errors or just return incorrect results:</p>
<ul>
<li><a href="/en-US/WebAPI/WebTelephony" title="/en-US/WebAPI/WebTelephony">Telephony</a></li>
<li><a href="/en-US/docs/WebAPI/WebSMS" title="/en-US/docs/WebAPI/WebSMS">WebSMS</a></li>
<li><a href="/en-US/docs/WebAPI/WebBluetooth" title="/en-US/docs/WebAPI/WebBluetooth">WebBluetooth</a></li>
<li><a href="/en-US/docs/WebAPI/Using_Light_Events" title="/en-US/docs/WebAPI/Using_Light_Events">Ambient Light</a></li>
<li><a href="/en-US/docs/WebAPI/Proximity" title="/en-US/docs/WebAPI/Proximity">Proximity</a></li>
<li><a href="/en-US/docs/WebAPI/Network_Information" title="/en-US/docs/WebAPI/Network_Information">Network Information</a></li>
<li><a href="/en-US/docs/Online_and_offline_events" title="/en-US/docs/Online_and_offline_events">navigator.onLine and offline events</a></li>
<li><a href="/en-US/docs/WebAPI/Vibration" title="/en-US/docs/WebAPI/Vibration">Vibration</a></li>
</ul>
<h2 id="Obter_ajuda"><a name="Simulator-help"></a>Obter ajuda</h2>
<p><span style="line-height: 1.5;">If you have a question, try asking us on the </span><a href="https://lists.mozilla.org/listinfo/dev-developer-tools" style="line-height: 1.5;">dev-developer-tools mailing list</a><span style="line-height: 1.5;"> or on </span><a href="irc://irc.mozilla.org/#devtools" style="line-height: 1.5;">#devtools on irc.mozilla.org</a><span style="line-height: 1.5;">.</span></p>
<h3 id="How_to_enable_verbose_logging"><a name="Simulator-verbose-logging"></a>How to enable verbose logging</h3>
<p>You can see messages logged from your app in the <a href="/en-US/docs/Tools/Web_Console">Web Console</a>, which you can attach to your app using the <a href="/docs/Tools/WebIDE/Troubleshooting">WebIDE</a>. If you want to catch early messages happening during app startup, before the console gets connected and working, you can enable verbose logging in the Simulator.</p>
<p>Visit about:config and <strong>create</strong> a new preference. The preference name is different for each version of the Simulator:</p>
<ul>
<li>extensions.fxos_1_3_simulator@mozilla.org.sdk.console.logLevel for Firefox OS 1.3</li>
<li>extensions.fxos_1_2_simulator@mozilla.org.sdk.console.logLevel for Firefox OS 1.2</li>
</ul>
<p>Set it to the string value "all", and disable, then reenable, the add-on in the Add-on Manager. Now extra messages about the Simulator's operation will appear in the <a href="/en-US/docs/Tools/Browser_Console">Browser Console</a>.</p>
<h2 id="Criar_o_Simulador">Criar o Simulador</h2>
<p>If you'd like to test patches to the Gecko or Gaia code that the Simulator contains, you may be interested in <a href="/en-US/Firefox_OS/Running_custom_builds_in_the_App_Manager">modifying the simulator</a> to use a custom Gecko build or Gaia profile. Alternatively, you can <a href="/en-US/Firefox_OS/Building_the_Firefox_OS_simulator">build a new Simulator</a> from your Gecko checkout.</p>
<h2 id="Alternativas">Alternativas</h2>
<p><a href="/en-US/Firefox_OS/Developing_Gaia/Different_ways_to_run_Gaia">Different ways to run Gaia</a> — including a list of them in <em>order</em> of ease for running and <em>reverse order</em> of closeness to the shipped product (according to it, Firefox OS Simulator is easiest but furthest).</p>
|