Development and deployment of Firefox OS apps

Source: Internet
Author: User

All Firefox OS applications adopt the HTML5 standard. As long as HTML, CSS, and JS are used, developing apps is very simple, but Firefox OS provides some features for mobile devices, such as phones, text messages, WiFi, and 3G networks. However, you can call these functions to manipulate JS objects like common JS components. Mozilla is also negotiating with W3C to add these new features to the HTML5 standard.

There are currently two methods to deploy the Firefox OS app.

1. Before Gaia compilation, put your app project (the directory structure of the app project will be described in detail below) to the apps or test_apps directory of Gaia source code, and then make

This method can be run in the simulator or burned to the B2G mobile phone to run your application.

2. Deploy your app to the Web server and install it online. In this case, you need to publish your application to the app store or write a separate page for app installation so that users can install your application through this page. Detailed descriptions will be provided later.

Next we will use a simple demo to illustrate how to develop the Firefox OS app.

1. Create a new folder named testapp as the project root directory (note that the folder name must be a lowercase letter)

2. Create index.html in the testappdirectory. The Code is as follows:

<! Doctype HTML>

3. Create manifest. webapp in the testapp directory. The Code is as follows:

{"Name": "test app", "launch_path": "/index.html", "Developer": {"name": "chy", "url ": "http://chyblog.sinaapp.com"}, "appcache_path": "/cache. manifest "," fullscreen ":" true "," icons ": {" 120 ":"/style/testapp.png "}," Permissions ": []}

Bytes

5. Deployment: We deploy testapp In the first method mentioned above, put test_apps under Gaia source code, and re-compile the GIAI source code. Run the simulator after compilation. In your Firefox OS, you will see your new application.

6. to install the application online, first place the application on the Web server and add an installation page. The source code is as follows:

<! Doctype HTML> Request. onsuccess = function () {// Save the app object that is returned var apprecord = this. Result; alert ('installation successful! ')}; Request. onerror = function () {// display the error information from the domerror object
Alert ('Install failed, error: '+ this. error. name) ;}}</SCRIPT> </A> </body>

You need

VaR request = Window. Navigator. cmdapps. Install ("http://demos.chyblog.com/testapp/manifest.webapp ");

Address secret in

After deployment, use the Firefox browser in B2G to access the URL of the installation page, click the "install test app" button, and install it as prompted. You can also use the demo page to install the application.

Effect

Source code download: http://chyblog-chyblog.stor.sinaapp.com/wp-content/uploads/2012/09/testapp.zip

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.