Thursday, September 16, 2010

PAW Runtime

PAW Runtime is basically a stripped down PAW Server that only listens to the loopback interface on a random port and with a WebView serving as browser frontend.
With this set-up it is possible to run PAW applications directly on the device.

Everything that's possible with PAW Server is also possible with the runtime version.


It enables users and programmers to directly develop applications on the device without the need to install a SDK on the PC.
Because the GUI is defined via HTML development of the interface is easy for people that know HTML/CSS and JavaScript.

There are of course limitations to this approach concerning speed and using all features of the platform, but for developing small applications or prototypes this should be sufficient.
What is not possible is to develop individual apps, all PAW Runtime apps reside in the /sdcard/paw-runtime directory and are accessible (when defined in the webconf/apps directory) from the main menu screen.

The runtime itself comes with no applications, but demo applications are available for download.
Below is the main menu with installed demo applications.


Let's have a look at the compass app shown in the first image.

All applications are stored in the /sdcard/paw-runtime/html folder. The application consists of a XHTML file and the corresponding jQuery scripts and images. Together with the demos comes a html/common folder that contains components (like JavaScript files) that can be reused.

Let's have a look at the XHTML file:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" href="../common/css/default.css">
<script type="text/javascript" src="../common/js/jquery.js"></script>
<script type="text/javascript" src="../common/js/executeScript.js"></script>
<script type="text/javascript" src="js/jquery.rotate.js"></script>
<script type="text/javascript">
$(document).ready(function() {

function updateCompass() {
executeScript('compassScript', null, 'compassRes');
$("#compassImg").rotate($("#compassRes").val() * -1, 'abs');
<img src="images/compass_rose.png" id="compassImg">
<div style="font-size: 30px; font-style: bold;" id="compass"></div>

<input type="hidden" id="compassRes" onChange="$('#compass').html($(this).val() + '°'); setTimeout('updateCompass();', 500);">

<!-- Script -->
<textarea id="compassScript" style="visibility:hidden; display: none;">

sensorListener = AndroidInterface.getSensorListener();
bearing = sensorListener.getOrientBearing();


The part that reads the bearing information of the device is surrounded by BeanShell <bsh>...</bsh> tags.
All the rest is standard HTML/JavaScript. A documentation of the functions provided by PAW comes bundled with the demo applications.

One last thing to do is to define the application's .conf file in the webconf/apps directory, so that the application is available from the main menu.

description=Displays Compass and Bearing

APK Download: PawRuntime.apk
Demos Download:
Eclipse Project:

Note: Files are based on PAW Server for Android 0.60 beta

The demos can be simply unpacked onto the /sdcard of the device.

PAW Runtime is currently in alpha state.
Comments are welcome...


  1. A short - maybe stupid - question, when i've allready installed the paw-webserver there is no need to install the runtime as well?
    Keep on doing your good work.

  2. Hi Oliver,

    the underlying server has the same capabilities.
    So web apps will run on both versions.
    The reason for the runtime was that web apps should look more like native apps. On my old Android 1.5 device the browser only works if networking is available.
    Apart from that there are situations (speech to text, bar code scanning) where the app has to be brought into foreground. As an example ... when using a browser the PAW app will pop into foreground opening the barcode scanner, when scanning is finished the user will be stuck in the PAW app and not return to the browser as expected.
    Anyway ... the web apps will work in both environments.

  3. Hi, i've tried to setup compass demo in paw server but an error ocuurs saying:
    error on line 19 at column 8: Opening and ending tag mismatch: link line 0 and head

    and the paw runtime not running on android 2.2.

  4. Hi CEG,
    this is strange. I tested PAW Runtime with a Nexus One which is running Android 2.2.

  5. Very good concept, I'm developing the paw runtime webapp on the paw server +desktop editor & browser; and running it on paw runtime. The paw runtime is much better for the end-user.
    1 question: how can the paw runtime window be fullscreen?
    Thank You for the good work!

  6. Fullscreen can be achieved by the following code:

    import android.view.WindowManager;

    service = server.props.get("serviceContext");
    activity = service.getActivity();
    webview = activity.findViewById(; Runnable() {
    public void run(){
    // Fullscreen ON
    // Fullscreen OFF


    Hope that helps...

  7. I've just uploaded a new version (0.16).
    This adds the following command:


    So the above code is no longer necessary!

  8. Hi,

    I am a new Droid X user who is trying to install the PAW webserver on my sdcard.

    I was able to install the webserver itself. I was able to start it. I have not at this point instalkled the zipped files to the sdcard. After using the suggested http address provided by your app, my browser invariably times out.
    So, while PAW is installed, it effectively is not operational.

    I have a couple of questions:

    1. Exactly where on the sdcard should I extract the zip file.

    2. After extracting the zip file, what do I do next?

    ---- Do I then run the PAW webserver and insert the http://.... in the address portion of the browser

    ---Or, should I start my browser before starting PAW? Does it make any difference?

    3. Which file or files on the zipped file should I run?

    4. My purpose in installing PAW on my phone is to look at a (large) collection hyperlinked html and pdf of files I
    transfered to my sd card. Should these files be placed in a particular folder for purposes of PAW?

    5. I am using Opera Mini on my Droid X. Is this ok? Is there a better browser? Any suggested settings for the browser?

    Sorry for the probably stupid questions. Your help would be appreciated.


  9. Anyway to get the eclipse project or source for the PAW-runtime server? So savvy developers can bundle their own apps with the PAW-runtime engine?

  10. Hi Brian,

    if there is interest in getting the Eclipse project, I'll clean things up and post the project.
    Just give me some time to do that...

  11. Eclipse project has been added to the list of downloads.

  12. Awesome! Thanks so much!! I'm downloading as I type this comment.

  13. I like this app but why is it on a random port. I want to be able to connect via a web browser on a computer, and not on an android phone. How do you set the port. Is this possible.

  14. If you would like to connect via another computer, please use the PAW server from the Android Market. The runtime is only meant for local connections.

  15. Hi Jochen, you make great apps!

    My question is if i can use php with paw runtime?, i'm trying put a php file in the href of the .conf file, but when i run it, the app show me a 'not found' message. Is the runtime enabled to execute a php files or only with xhtml with bsh code?

    Thanks a lot Jochen!

    1. This is the first request to run PHP with the runtime version.
      In principle this should work.
      I'll have a look at it and will try to blog about it this week.

  16. hi!
    i'd be interrested to... :)

    good job !

  17. Absolutely brilliant. Yet, I can't seem to get the Runtime eclipse source to work properly.

    1. If you send me a mail (jochen[at] describing the problems you have, I'll have a look at it.

  18. Hi, Under what license is this awesome app. released ?

    1. You can use the runtime version and its source code freely for private or educational purposes.

  19. Great idea, I'm creating the paw runtime webapp on the paw server +desktop manager & program; and running it on paw runtime. The paw runtime is much better for the end-client.

    designers web // Best Web Design

  20. Replies
    1. JSPs won't run. PAW is not a Servlet container. You have to use i-jetty or the like.

  21. BlueHost is ultimately the best hosting company with plans for any hosting requirements.


Note: Only a member of this blog may post a comment.