Running the Tizen SDK Simulator on non-Ubuntu Linux

This explains the steps you need to get the Tizen web-simulator working on Linux. Also shown is a small example of how to exercise some of the HTML5 APIs in Tizen to demonstrate how the web-simulator does its stuff.

The aim here is to get a working Tizen dev environment, without having to download and run the full Tizen SDK (a 1Gb download), and on platforms which aren't officially supported (only Windows and Ubuntu are supported, but I use Fedora). It's not the recommended or official way to develop for Tizen (see https://developer.tizen.org/sdk for that), but it is a way to use a bit of it. I also can't vouch for whether it's a sensible thing to do as I've only tested small applications with it so far. But it is fun.

The web-simulator is actually a fairly small (5Mb) Chrome extension, which is based on a fork of Ripple:

"Ripple is a multi-platform mobile environment emulator that runs in a web browser and is custom-tailored to HTML5 mobile application testing." (http://ripple.tinyhippos.com/ ; NB the company that developed it has been acquired by RIM).

The web-simulator extends Ripple with stubs for the APIs which are specific to Tizen, but not necessarily present in other HTML5 environments (e.g. sensor and messaging capabilities). This enables you to build applications which use those APIs if you don't have access to Tizen hardware. (The other alternative is to use the full Tizen SDK, which provides an emulator that runs "real" versions of the APIs; however, this is a big install and only works on Ubuntu and Windows.)

Also note that the web-simulator has decent end-user documentation, explaining what the UI does.

The steps:

1. You can get the web-simulator code from the project's git repo: https://github.com/01org/web-simulator

The master branch is way behind ongoing work (by about 5 months); so you might have better luck with the "next" branch, which seems to be where work is ongoing.

To clone the project and get onto the right branch:

$ git clone https://github.com/01org/web-simulator.git
$ cd web-simulator
$ git checkout next

2. Now you have the source code for the web-simulator. We're just going to use a part of this to set the simulator up to work with Chrome.

The piece we need is in this location (relative to the directory you made the clone from):

./pkg/web

So copy those files somewhere else to make them easier to get at:

$ mkdir ~/tizen-simulator
$ cp -a ./pkg/web/* ~/tizen-simulator/

Take a look to check you have the right files:

$ cd ~/tizen-simulator
$ ls
beep.wav           cache.manifest  index.html    ripple.css 
browserCheck.html  images          package.json  ripple.html  ripple.js     themes

That's all the code you need for the web-simulator.

3. Open up Google Chrome (a recent version; I'm using 20.0.1132.3 dev) and type the URI for the web-simulator in the address bar, i.e.:

file:///home/user/tizen-simulator/index.html

(replace "user" with your Linux account username)

You should see the web-simulator UI with a blank "phone" in it.

4. You need a project to test against, so make one like this:

$ mkdir ~/tizen-messaging-test

Then add two files to this directory.

~/tizen-messaging-test/index.html:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0,
                   maximum-scale=1.0, user-scalable=0, target-densityDpi=device-dpi">
    <meta name="description" content="Tizen web app"/>
    <title>messaging test</title>
</head>

<body>
  <p>Tizen web-simulator running on Linux.</p>
  &lt;script src="main.js"&gt;&lt;/script&gt;
</body>
</html>

(you need to use real script tags, but I can't put them in here as the Drupal editor removes them...)

and ~/tizen-messaging-test/main.js:

window.onload = function () {
  var errorCb = function (err) {
    console.error(err);
  };

  var successCb = function (services) {
    if (services.length === 0) {
      console.error('could not get email service');
      return;
    }

    var service = services[0];

    // listen for message changes; NB when the message is sent below,
    // it appears in the OUTBOX folder and a notification is logged
    var messagesChangedListener = {
      messagesadded: function (messages) {
        console.log(messages[0].folderId);
      },
      messagesupdated: function (messages) {},
      messagesremoved: function (messages) {}
    };

    service.messageStorage.addMessagesChangeListener(messagesChangedListener);

    // send a message
    var msg = new tizen.Message("messaging.email", {
      'to': ['bingo.barry@bogus.com'],
      'subject': 'hello email from Tizen web app',
      'plainBody': 'hello'
    });

    service.sendMessage(
      msg,
      function (recipients) { console.log(recipients); },
      errorCb
    );
  };

  tizen.messaging.getMessageServices("messaging.email", successCb, errorCb);
};

See the Tizen developer docs for more information about the APIs supported. Also note that I'm not suggesting this as a sane pattern for structuring an application.

5. Open the web-simulator at your new project by entering the address in Chrome:

file:///home/user/tizen-simulator/index.html?url=file:///home/user/tizen-messaging-test/index.html

(replace "user" with your Linux username)

Note that the URL of the project is passed as a url=xxx parameter to the Tizen simulator.

Also note that things don't work so nicely if you run the web-simulator and the application on different domains (you get cross domain errors), even if the Simulator is a Chrome extension with permissions set to allow requests to any domain (I tried). The easiest thing to do is run both from file:// URIs.

You should see the index.html page in the "phone" with the message:

"Tizen web-simulator running on Linux."

Like this:

Next, Ctrl+Shift+j to see the console output. You should see something like:

Ripple :: Environment Warming Up (Tea. Earl Gray. Hot.)   ripple.js:27588
TIZEN :: Initialization Finished (Make it so.)            ripple.js:27588
OUTBOX                                                    main.js:11
["bingo.barry@bogus.com"]                                 main.js:28

"OUTBOX" is the name of the folder containing the sent message (i.e. it's queued and ready to go); ["bingo.barry@bogus.com"] is an array of the recipient names to whom the message was successfully sent. This proves that the web-simulator's API stubs are working correctly.

One other thing you might notice is that if you click the refresh button inside the simulator to reload the project, you get this in the console:

Uncaught ReferenceError: tizen is not defined                                 main.js:41
TIZEN :: -----------------------------------------------------------          ripple.js:27588
TIZEN :: Pay no attention to that man behind the curtain.                     ripple.js:27588
TIZEN :: Environment Warning up again (Set main batteries to auto-fire cycle) ripple.js:27588
TIZEN :: Initialization Finished (Make it so.) ripple.js:27588
Uncaught TypeError: Cannot call method 'log' of undefined                     main.js:11
["bingo.barry@bogus.com"]

I haven't tracked down the source of this, but if you refresh the whole window, it seems to resolve itself.

That's it. You can continue developing your application with whatever JavaScript libraries take your fancy.

Comments

Your knowledge of this

Your knowledge of this subject comes through clearly in this article. I love to read this kind of articles, I hope you will update it. Thank you for sharing it with me. www.balenciagasneakers.org/

I haven't added RSpec as a

I haven't added RSpec as a gem dependency (you can ignore the tests if you like), but for reference I developed the tests using RSpec 0.5.12). California Drivers Ed Online

Backdrop Outlet’s durable

Backdrop Outlet’s durable Titanium Cloth backdrops are made from a wrinkle-free, fleece-like fabric that provides vivid color Cheap Kids Shoes.

Reply

The information you provided were totally worth reading. This explains the steps you need to get the Tizen web-simulator working on Linux. I have book marked your page for further updates. Keep up the good work. Regards. windows live support phone number

A wonderful and unique

A wonderful and unique lifestyle awaits you. Please see Belgravia Villas project details and floor plans for more information.
Ang Mo Kio Cluster House

It's difficult for me to

It's difficult for me to using it. I have been so usual to use Windows as my operating system.
structured settlement quotes

Hello my friend! I want to

Hello my friend! I want to say that this article is awesome, nice written and include approximately all significant infos. I would like to peer extra posts like this .
tapetes con logo

yes you are right really

yes you are right really nice article good work, thanks to share this Linux coding with us thankS SO MUCH.
Boynton Beach Locksmith

The satisfaction of doing it

The satisfaction of doing it yourself. If you still can't decide what kind of trailer to get, let us help you out.
social work school

reply

This post can easily give straight answers to help you subscribers, prefer individuals. With some luck which you’ve written might well be significantly more of great benefit in order to keep to jot down a person's communiques. Many thanks for this specific rather revealing creating. racheal

After I initially commented

After I initially commented I clicked the Notify me when new comments are added checkbox and now every time a comment is added I get four emails with the identical comment. Is there any method you can take away me from that service? Thanks! - Guest House Semarang