Artikel ini perlu semakan teknikal. Cara untuk anda membantu.
Sukarelawan kami masih belum menterjemah artikel ini ke Melayu lagi. Sertai kami dan bantu melaksanakannya!
Depending on your specific needs, you have an assortment of options to consider when experimenting with Firefox OS or the Gaia user interface. You can choose among the following options; each has its advantages and disadvantages to consider, and some are more flexible than others.
Running B2G on the desktop
It's possible to build a Firefox OS simulator and run Gaia on it. This software is based on Firefox but behaves very much like the on-device experience of Firefox OS. Currently Mozilla provides nightly builds of this application for developers. If you are familiar with building the Firefox code-base or C++ projects, you can build this application yourself.
Advantages
- The simulator provides a mobile-sized viewport.
- The experience is similar to a real mobile device in most respects.
- More (but not all) device APIs are available.
Disadvantages
- You need to actually have a C/C++ build system installed.
- You need to build Gecko and the simulator yourself.
- The Firefox developer tools are not available
Why run the B2G simulator?
This is a good middle-of-the-road testing and development solution. It's a good way to get a better feel for how your app or other code will work in a device-like environment without actually having to flash a phone every time you want to test something.
Simulator varieties
There are several varieties of the Firefox OS Simulator available:
- Firefox OS Simulator add-on
- This extension is the primary tool for testing apps running on Firefox OS, and is the recommended solution for most users. It includes support for developer tools, adding apps to the test environment, and so forth.
- Developer desktop builds
- These builds of the simulator are stand-alone applications that are primarily intended to help core Firefox OS developers to verify technical features.
- Localizer desktop builds
- The localizer builds are primarily useful for localization teams to work on and test their localizations of Firefox OS and of Firefox OS apps.
Running B2G in an emulator
This solution lies inbetween the simulators (which only replicate the higher levels of the Firefox OS system) and the actual device runs (which gets you the full experience). Compared to the simulators, the emulators run an Firefox OS on an ARM-based system (the x86 emulator being deprecated) which replicates almost the entirety of the phone experience (barring some of the network/radio events).
Running B2G on a mobile device
The most thorough way to test your B2G or Gaia development work, or your web app, is to build and install Firefox OS on a real mobile device. This is also the most complicated process.
Advantages
- You get the full mobile device experience.
- All device APIs are available.
- You can experience your code's performance in real device usage.
Disadvantages
- You need a full C/C++ build system installed.
- You need to build Gecko and Gaia yourself.
- You need a compatible mobile device on which to install the B2G operating system.
- You need to flash the device with B2G, removing whatever operating system is currently installed.
Why to run B2G on a mobile device
This is, obviously, the most accurate way to test any code or web project on B2G or Gaia. By running on actual mobile hardware, you can ensure that your project performs well and looks good, and uses all device APIs correctly. In addition, you should always test on real hardware before shipping any code; failing to do so can have unfortunate effects that can be hard to predict.