| (5 intermediate revisions not shown) | |||
| Line 3: | Line 3: | ||
'''Web Runtime and the Web SDK are provided as preview/beta technology.''' | '''Web Runtime and the Web SDK are provided as preview/beta technology.''' | ||
| - | The MeeGo SDK enables Web Runtime (WRT) development for MeeGo. The following is a simple guide to get you going with this exciting, flexible, and highly portable development environment. | + | ''The final role, or lack thereof, of WRT in MeeGo should be explained here --[[User:Vivainio|Vivainio]] 06:59, 31 January 2011 (UTC)'' |
| + | |||
| + | The Web SDK enables Web Runtime (WRT) development for MeeGo. The following is a simple guide to get you going with this exciting, flexible, and highly portable development environment. | ||
== What is Web Runtime? == | == What is Web Runtime? == | ||
| - | The MeeGo Web Runtime engine allows | + | The MeeGo Web Runtime engine allows Web Apps to run outside of the browser. A Web App is a small application built using web technologies such as Javascript, HTML, and CSS. These are often run inside a browser as add-ons. With MeeGo WRT these Web Apps can be installed and behave as stand-alone applications. |
== What do I need to get started? == | == What do I need to get started? == | ||
| Line 15: | Line 17: | ||
=== Web Runtime IDE === | === Web Runtime IDE === | ||
| - | The | + | The Web SDK provides a full development environment with support for creating MeeGo WRT apps. <br> |
It includes: | It includes: | ||
* the Web Developer Environment: an [http://wiki.eclipse.org/index.php/Rich_Client_Platform Eclipse]-based integrated development environment (code editor, debugger, packager etc.) | * the Web Developer Environment: an [http://wiki.eclipse.org/index.php/Rich_Client_Platform Eclipse]-based integrated development environment (code editor, debugger, packager etc.) | ||
* the Web SDK Simulator: runs applications in WebKit-based simulator | * the Web SDK Simulator: runs applications in WebKit-based simulator | ||
| - | ==== Download the | + | ==== Download the Web SDK Technology Preview ==== |
<table border='1' cellpadding='3px' style="padding: 0em"> | <table border='1' cellpadding='3px' style="padding: 0em"> | ||
<tr><th>Platform</th><th>Size</th><th>Location</th></tr> | <tr><th>Platform</th><th>Size</th><th>Location</th></tr> | ||
| Line 32: | Line 34: | ||
=== Documentation / APIs === | === Documentation / APIs === | ||
| - | The majority of the Web Runtime documentation is located on Forum Nokia and includes [http://www.forum.nokia.com/Develop/Web/Getting_started/Step_2_Start.xhtml tutorials about developing | + | The majority of the Web Runtime documentation is located on Forum Nokia and includes [http://www.forum.nokia.com/Develop/Web/Getting_started/Step_2_Start.xhtml tutorials about developing Web Apps]. The reason for ''this'' page is to briefly highlight the differences when developing Web Runtime Apps for MeeGo. |
== First WRT project == | == First WRT project == | ||
| Line 42: | Line 44: | ||
# Choose ''Basic web app project'' and click ''Next >''. | # Choose ''Basic web app project'' and click ''Next >''. | ||
# Enter the project name and choose a directory to create the project in. | # Enter the project name and choose a directory to create the project in. | ||
| - | # Enter the | + | # Enter the display name (how it will be listed on the device). |
| - | # Enter a unique identifier for your | + | # Enter a unique identifier for your Web App; if possible, use your own company or personal domain, with the name of the project appended. For example, I used <code>http://developer.meego.com/elliot/helloworld</code>. |
| - | + | ||
# Enter 0.0.1 for the version. | # Enter 0.0.1 for the version. | ||
# Click ''Next >''. | # Click ''Next >''. | ||
| - | # Enter names for the three files which will form the basis of the | + | # Enter names for the three files which will form the basis of the Web App (the defaults are fine for now). |
# Click ''Finish''. | # Click ''Finish''. | ||
| Line 64: | Line 65: | ||
=== Running the simulator === | === Running the simulator === | ||
| - | To preview the | + | To preview the Web App in the simulator: |
# Right-click on the project name in the ''Project Explorer''. | # Right-click on the project name in the ''Project Explorer''. | ||
# Select ''Preview Web app'' from the context menu. | # Select ''Preview Web app'' from the context menu. | ||
| - | # The simulator should start and display your | + | # The simulator should start and display your Web App, for example: |
[[File:Websdk-simulator.png|600px]] | [[File:Websdk-simulator.png|600px]] | ||
| Line 74: | Line 75: | ||
=== Adding JavaScript === | === Adding JavaScript === | ||
| - | Interactivity is added to | + | Interactivity is added to Web Apps by writing JavaScript functions and hooking them to the interface. You can add your own functions to the <code>basic.js</code> JavaScript file, automatically created for your project by WDE. |
Start by editing the <code>index.html</code> and adding a form with a text entry box and button (NB this is HTML5): | Start by editing the <code>index.html</code> and adding a form with a text entry box and button (NB this is HTML5): | ||
| Line 133: | Line 134: | ||
== Debugging == | == Debugging == | ||
| - | WebSDK provides debugging for | + | WebSDK provides debugging for Web Apps running inside the simulator. |
<ol> | <ol> | ||
| Line 141: | Line 142: | ||
<li>In the ''Project Explorer'', inside the expanded project content, right-click on the ''index.html'' file and select ''Debug As > Web Application''. This starts the application in the simulator, and switches WDE into debugging perspective.<br/> | <li>In the ''Project Explorer'', inside the expanded project content, right-click on the ''index.html'' file and select ''Debug As > Web Application''. This starts the application in the simulator, and switches WDE into debugging perspective.<br/> | ||
If the perspective doesn't change, go to the ''Window'' menu and select ''Open Perspective > Debug''.</li> | If the perspective doesn't change, go to the ''Window'' menu and select ''Open Perspective > Debug''.</li> | ||
| - | <li>Use the | + | <li>Use the Web App in the simulator.</li> |
<li>When you perform an action which will cause the code at the breakpoint to be executed (in this case, clicking the button), the simulator pauses and passes focus back to WDE. WDE may prompt you to confirm the switch to the ''Debug'' perspective: tick the ''Remember my decision'' box and click ''Yes'', so that the perspective automatically switches in future.<br/> | <li>When you perform an action which will cause the code at the breakpoint to be executed (in this case, clicking the button), the simulator pauses and passes focus back to WDE. WDE may prompt you to confirm the switch to the ''Debug'' perspective: tick the ''Remember my decision'' box and click ''Yes'', so that the perspective automatically switches in future.<br/> | ||
You should now see the ''Debug'' perspective, with a cursor at the breakpoint, like this:<br/> | You should now see the ''Debug'' perspective, with a cursor at the breakpoint, like this:<br/> | ||
| Line 152: | Line 153: | ||
Web Runtime on MeeGo uses the <code>wgt</code> packaging format: it's a zip file with configuration metadata in a <code>config.xml</code> file. The configuration follows the [http://www.w3.org/TR/widgets/ W3C Widget Packaging and Configuration] specification. | Web Runtime on MeeGo uses the <code>wgt</code> packaging format: it's a zip file with configuration metadata in a <code>config.xml</code> file. The configuration follows the [http://www.w3.org/TR/widgets/ W3C Widget Packaging and Configuration] specification. | ||
| - | |||
| - | |||
The WDE makes it very simple to create a <code>wgt</code> package from a project: | The WDE makes it very simple to create a <code>wgt</code> package from a project: | ||
| Line 164: | Line 163: | ||
Once you have created a <code>wgt</code> package, transfer it to your device and run it. | Once you have created a <code>wgt</code> package, transfer it to your device and run it. | ||
| - | === Getting the | + | === Getting the package to the device === |
The manual approach is to copy the <code>wgt</code> file to the device. If you have network access to the device, you could push it to the device using ssh or similar; or log in to the device and pull the file over, using a network share, a website, [http://www.home.unix-ag.org/simon/woof.html Woof] etc. | The manual approach is to copy the <code>wgt</code> file to the device. If you have network access to the device, you could push it to the device using ssh or similar; or log in to the device and pull the file over, using a network share, a website, [http://www.home.unix-ag.org/simon/woof.html Woof] etc. | ||
| Line 174: | Line 173: | ||
WDE also has a ''Deploy Web app'' option, but this requires a bluetooth connection to the target device from the host. | WDE also has a ''Deploy Web app'' option, but this requires a bluetooth connection to the target device from the host. | ||
| - | === Installing the | + | === Installing the Web App === |
Install the <code>qt-web-runtime</code> packages on the target MeeGo device (real or emulated): | Install the <code>qt-web-runtime</code> packages on the target MeeGo device (real or emulated): | ||
| Line 180: | Line 179: | ||
$ zypper install qt-web-runtime | $ zypper install qt-web-runtime | ||
| - | See [[#Installing and running example | + | See [[#Installing and running example Web Apps]] for more about running the WRT examples. |
| - | Once the Web Runtime components are installed, you are ready to install your new | + | Once the Web Runtime components are installed, you are ready to install your new Web App: |
$ sudo widgetinstaller <path to .wgt file> | $ sudo widgetinstaller <path to .wgt file> | ||
| - | This creates a new <code>.desktop</code> file in <code>/usr/share/applications/</code> for your | + | This creates a new <code>.desktop</code> file in <code>/usr/share/applications/</code> for your Web App. Your Web App will now appear with other applications. |
| - | === Running the | + | === Running the Web App === |
| - | Run your | + | Run your Web App by clicking on its icon in the ''Applications'' zone; or, run it from the command line with: |
$ webwidgetrunner <path to .desktop file created in previous step> | $ webwidgetrunner <path to .desktop file created in previous step> | ||
| - | == Installing and running example | + | == Installing and running example Web Apps == |
| - | The <code>qt-web-runtime-examples</code> package for MeeGo includes a set of example | + | The <code>qt-web-runtime-examples</code> package for MeeGo includes a set of example Web Apps you can run to get an idea of WRT's capabilities. The package places them in <code>/usr/lib/wrt/examples/demowidgets/</code>, but they must be installed before they can be used. |
| - | For example, to install the bouncing ball | + | For example, to install the bouncing ball Web App: |
$ widgetinstaller /usr/lib/wrt/examples/demowidgets/Bouncingball.wgt | $ widgetinstaller /usr/lib/wrt/examples/demowidgets/Bouncingball.wgt | ||
Web Runtime and the Web SDK are provided as preview/beta technology.
The final role, or lack thereof, of WRT in MeeGo should be explained here --Vivainio 06:59, 31 January 2011 (UTC)
The Web SDK enables Web Runtime (WRT) development for MeeGo. The following is a simple guide to get you going with this exciting, flexible, and highly portable development environment.
Contents |
The MeeGo Web Runtime engine allows Web Apps to run outside of the browser. A Web App is a small application built using web technologies such as Javascript, HTML, and CSS. These are often run inside a browser as add-ons. With MeeGo WRT these Web Apps can be installed and behave as stand-alone applications.
MeeGo already comes with the web runtime engine installed. You just need to install your WRT application (.wgt file)
The Web SDK provides a full development environment with support for creating MeeGo WRT apps.
It includes:
| Platform | Size | Location |
|---|---|---|
| Windows | 188MB | http://tools.nokia.com/wrt/install/1.0/Nokia_Web_SDK_1.0.1.exe |
| Linux (debian) | 191MB | http://tools.nokia.com/wrt/install/1.0/NokiaWebSDK_1.0.1.deb |
| Linux (rpm*) | 192MB | http://wiki.meego.com/SDK/Docs/1.1/Web_Runtime_RPM_for_MeeGo |
| OSX (pkg) | 222MB | http://tools.nokia.com/wrt/install/1.0/NokiaWebSDK_1.0.1.pkg |
You can probably do the majority of your development using the included simulator. Eventually you'll also need a MeeGo device to deploy to, either emulated or real. See these instructions.
The majority of the Web Runtime documentation is located on Forum Nokia and includes tutorials about developing Web Apps. The reason for this page is to briefly highlight the differences when developing Web Runtime Apps for MeeGo.
For the first project, we'll write a very simple "hello world" application which displays a form for a user to enter their name. JavaScript responds to the user's input and displays a personalised greeting, including the user's name.
http://developer.meego.com/elliot/helloworld.
Your project should now be visible in the File view, under Projects.
Expand the project and double-click on the index.html page. You should see the source of the HTML file in the main panel.
Add a paragraph inside the <body> tag, for example:
<p>Hello world</p>
Save it.
To preview the Web App in the simulator:
Interactivity is added to Web Apps by writing JavaScript functions and hooking them to the interface. You can add your own functions to the basic.js JavaScript file, automatically created for your project by WDE.
Start by editing the index.html and adding a form with a text entry box and button (NB this is HTML5):
<!DOCTYPE html>
<html>
<head>
<title>Greet</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script language="javascript" type="text/javascript" src="basic.js"></script>
<link rel="stylesheet" href="basic.css" type="text/css"/>
</head>
<body onload="init();">
<!-- form to enter a name -->
<form method="post" action="index.html">
<p><label for="name">Name</label>: <input type="text" name="name" id="name"/></p>
<p><input type="button" value="Greet" onclick="greet();"/></p>
</form>
<!-- greeting will be displayed inside this paragraph -->
<p id="greetings"/>
</body>
</html>
The button's onclick attribute is set to the greet() callback, which we add to basic.js (note I've left the default init() function, which doesn't do anything at present):
function init() {
}
/* get the value from the name input element and display it in a greeting */
function greet() {
var name = document.getElementById('name').value;
if (name != '')
document.getElementById('greetings').innerHTML = "Hello " + name;
}
Open index.html in the simulator tab again. Enter something in the text box and click on the Greet button to call the JavaScript function and display a greeting.
You should see something like this:
Note: you may occasionally need to click on the Reload button in the simulator to load your changes, as it doesn't always pick up when you save a file.
Developing client-side JavaScript applications is beyond the scope of this tutorial, but good places to find out more are:
WebSDK provides debugging for Web Apps running inside the simulator.
basic.js file by double-clicking in the margin next to a line of code. Notice in the screenshot below how a small blue circle is displayed next to the line:Web Runtime on MeeGo uses the wgt packaging format: it's a zip file with configuration metadata in a config.xml file. The configuration follows the W3C Widget Packaging and Configuration specification.
The WDE makes it very simple to create a wgt package from a project:
<your project name>.wgt; in the case of my example project, helloworld.wgt.
Once you have created a wgt package, transfer it to your device and run it.
The manual approach is to copy the wgt file to the device. If you have network access to the device, you could push it to the device using ssh or similar; or log in to the device and pull the file over, using a network share, a website, Woof etc.
For example, if you have an emulated MeeGo image, you could push the file to it with:
$ scp -p 6666 <path to .wgt> meego@127.0.0.1:/<path on target image>
WDE also has a Deploy Web app option, but this requires a bluetooth connection to the target device from the host.
Install the qt-web-runtime packages on the target MeeGo device (real or emulated):
$ zypper install qt-web-runtime
See #Installing and running example Web Apps for more about running the WRT examples.
Once the Web Runtime components are installed, you are ready to install your new Web App:
$ sudo widgetinstaller <path to .wgt file>
This creates a new .desktop file in /usr/share/applications/ for your Web App. Your Web App will now appear with other applications.
Run your Web App by clicking on its icon in the Applications zone; or, run it from the command line with:
$ webwidgetrunner <path to .desktop file created in previous step>
The qt-web-runtime-examples package for MeeGo includes a set of example Web Apps you can run to get an idea of WRT's capabilities. The package places them in /usr/lib/wrt/examples/demowidgets/, but they must be installed before they can be used.
For example, to install the bouncing ball Web App:
$ widgetinstaller /usr/lib/wrt/examples/demowidgets/Bouncingball.wgt
You can then run it from the Applications zone (there should be an icon for it) or the command line with:
$ webwidgetrunner /usr/share/applications/CSSBouncingBall.desktop
(The exact location of the .desktop file might require you to do some digging; ls -tlr /usr/share/applications/ can help identify the most recently added desktop file.)