Posts

Showing posts from June, 2011

How to use web database feature of HTML5? HTML5 + Web Database + Java Script + Android + Chrome

I have created a HTML5 sample which demonstrates how to use web database.

In following sample, jquery and jsapi are being downloaded from internet on the fly at run-time. So make sure you have internet connection when you test the sample. Otherwise, you can download both jquery and jsapi from source and copy them in some local folder then load jquery and jsapi scripts from local folder.

HTML5 web database sample is as follows:
<!DOCTYPE html>
<html> 
  <head>
    <title>Offline Contacts Store using HTML5 Web Database</title>
    <script src="http://www.google.com/jsapi"></script>
    <script>
      google.load("jquery", "1.4.1");
    </script>
    <script>
      var db = window.openDatabase("contacts", "", "contacts", 1024*1024);

      if (db == null) alert ("Database not found DB: " + db);

      function insertRecord(number, name, email) {
       db…

How to run HTML5 app from Android app? Android + WebView + HTML5 + Java Script + Web DB

I was trying to make HTML 5 sample run from Android app. I was trying to use local database feature of HTML 5 app which works well with my Android 2.3.3 version device.

Following code worked for me:

WebView webview = (WebView) findViewById(R.id.webview);

webview.setWebChromeClient(new WebChromeClient() {
@Override
public void onExceededDatabaseQuota(String url, String
databaseIdentifier, long currentQuota, long estimatedSize,
long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater) {
quotaUpdater.updateQuota(estimatedSize * 2); // try to keep quota size as big as possible else database will not get created in HTML 5 app
}
});

WebSettings settings = webview.getSettings();
settings.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setDatabaseEnabled(true);

String databasePath = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
settings.setDatabasePath(databasePath);

Issue: I was using following java …

Getting started with MonoCross

What is MonoCross?

MonoCross is a C# .NET Model-View-Controller (MVC) framework where the Model and Controller are shared across platforms and the View is implemented for every specific platform and/or target architecture. It allows the development of both native and HTML5 web apps that share business logic and data code.

MonoCross is based on a modified Model-View-Controller pattern that enables separation of the presentation layer, (View) from the application code (Model + Controller). This modification enables portability of application code across multiple platform targets.
Source code and solution files for the MonoCross pattern, and the Best Sellers sample. Includes container projects for Windows Console, Mobile WebKit, iOS*, and Android^
*iOS projects require MonoTouch and MonoDevelop, all other platforms can be developed in Microsoft Visual Studio.
^Android projects require Mono for Android and Visual Studio Professional 2010.

Although MonoTouch and MonoDroid use the same langua…