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.
Overview |
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.
Menu |
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:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <title>Compass</title> <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() { updateCompass(); }); function updateCompass() { executeScript('compassScript', null, 'compassRes'); $("#compassImg").rotate($("#compassRes").val() * -1, 'abs'); } </script> </head> <body> <center> <h1>Compass</h1> <img src="images/compass_rose.png" id="compassImg"> <p> <div style="font-size: 30px; font-style: bold;" id="compass"></div> </p> </center> <input type="hidden" id="compassRes" onChange="$('#compass').html($(this).val() + '°'); setTimeout('updateCompass();', 500);"> <!-- Script --> <textarea id="compassScript" style="visibility:hidden; display: none;"> import de.fun2code.android.pawserver.AndroidInterface; sensorListener = AndroidInterface.getSensorListener(); bearing = sensorListener.getOrientBearing(); $$.print(bearing); </textarea> </body> </html>
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.
name=Compass description=Displays Compass and Bearing icon=compass/images/compass_rose.png href=compass/compass.xhtml
APK Download: PawRuntime.apk
Demos Download: PawRuntime_Demos.zip
Eclipse Project: AndroidPawRuntime_Eclipse_Project.zip
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...
A short - maybe stupid - question, when i've allready installed the paw-webserver there is no need to install the runtime as well?
ReplyDeleteKeep on doing your good work.
Oliver
Hi Oliver,
ReplyDeletethe 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.
Hi, i've tried to setup compass demo in paw server but an error ocuurs saying:
ReplyDeleteerror 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.
CEG
Hi CEG,
ReplyDeletethis is strange. I tested PAW Runtime with a Nexus One which is running Android 2.2.
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.
ReplyDelete1 question: how can the paw runtime window be fullscreen?
Thank You for the good work!
Sztyopi
Fullscreen can be achieved by the following code:
ReplyDeleteimport android.view.WindowManager;
import de.fun2code.android.pawserver.*;
service = server.props.get("serviceContext");
activity = service.getActivity();
webview = activity.findViewById(de.fun2code.android.pawruntime.R.id.webview);
webview.post(new Runnable() {
public void run(){
// Fullscreen ON
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
// Fullscreen OFF
//activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
});
Hope that helps...
I've just uploaded a new version (0.16).
ReplyDeleteThis adds the following command:
fullscreen(boolean)
So the above code is no longer necessary!
Hi,
ReplyDeleteI 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.
Thanks!
bestresearcher@gmail.com
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?
ReplyDeleteHi Brian,
ReplyDeleteif 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...
Eclipse project has been added to the list of downloads.
ReplyDeleteAwesome! Thanks so much!! I'm downloading as I type this comment.
ReplyDeleteI 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.
ReplyDeleteIf 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.
ReplyDeleteHi Jochen, you make great apps!
ReplyDeleteMy 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!
This is the first request to run PHP with the runtime version.
DeleteIn principle this should work.
I'll have a look at it and will try to blog about it this week.
hi!
ReplyDeletei'd be interrested to... :)
good job !
Absolutely brilliant. Yet, I can't seem to get the Runtime eclipse source to work properly.
ReplyDeleteIf you send me a mail (jochen[at]fun2code.de) describing the problems you have, I'll have a look at it.
DeleteHi, Under what license is this awesome app. released ?
ReplyDeleteYou can use the runtime version and its source code freely for private or educational purposes.
DeleteGreat 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.
ReplyDeletedesigners web // Best Web Design
Where to place jsp files?
ReplyDeleteJSPs won't run. PAW is not a Servlet container. You have to use i-jetty or the like.
Delete