yannis assael | the blog

  • Home
  • About
  • Categories
    • Android
    • Computing
    • iOS
    • Machine Learning
    • MacOSX
  • GitHub
  • Mobile Apps
  • yannisassael.com


Posts Tagged ‘gwt-phoengap’

A little bit of Android, Phonegap and GWT (gwt-phonegap)

Written by iassael on 04/02/2012. Posted in android, general

This guide will demonstrate how to build the gwt-phonegap showcase application on Android
1) Checkout from here http://code.google.com/p/gwt-phonegap/source/browse/gwtphonegap.showcase.gwt/src/main/java/com/googlecode/gwtphonegap/?repo=showcase

(for more info http://code.google.com/p/gwt-phonegap/wiki/GettingStarted)

2) Edit your index.html so that it looks like this:

<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>index</title>
<script type="text/javascript" language="javascript" src="phonegap.js"></script>
<script type="text/javascript" language="javascript"
src="ChildBrowser.js"></script>
 
<script type="text/javascript">
document.addEventListener("deviceready", (function() {
PhoneGap.available = true;
}), false);
</script>
 
<script type="text/javascript" language="javascript"
src="showcase/showcase.nocache.js"></script>
</head>
 
<body>
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'
style="position: absolute; width: 0; height: 0; border: 0"></iframe>
 
</body>
</html>

<!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>index</title> <script type="text/javascript" language="javascript" src="phonegap.js"></script> <script type="text/javascript" language="javascript" src="ChildBrowser.js"></script> <script type="text/javascript"> document.addEventListener("deviceready", (function() { PhoneGap.available = true; }), false); </script> <script type="text/javascript" language="javascript" src="showcase/showcase.nocache.js"></script> </head> <body> <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position: absolute; width: 0; height: 0; border: 0"></iframe> </body> </html>

3. Run GWT Compile

4. Create a new Android Project

5. Add Phonegap Lib as described here http://phonegap.com/start#android

6. Copy everything from the %SHOWCASE%\target\gwtphonegap-showcase-gwt-1.2.0.0-SNAPSHOT directory to the Android Project \asserts\www directory

7. Make your Activity look like this:

public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   super.loadUrl("file:///android_asset/www/index.html");
}

public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.loadUrl("file:///android_asset/www/index.html"); }

8. Ready to go!

Sorry I was not that analytic about the process. Please feel free to contact me for any help!
J.

 

  • Continue Reading
  • 5 Comments