Posts Phonegap
Post
Cancel

Phonegap

Today I tried phonegap, the flow was :

-install the gui program (PhoneGapSetup-win32.exe) -create a new project -on the prj folder, exists a folder called www, drop your html PRJ there -then to compile for xap/ipa/apk I go to https://build.phonegap.com, made a free account -zip the www files+folders, upload zip, press build!

FYI login to https://www.adobe.com/account.html

better use https://cordova.apache.org/

http://cordova.apache.org/docs/en/5.0.0/guide/platforms/android/index.html

https://www.npmjs.com/package/cordova


Unfornutaley Phonegap has an important disadvantage: whenever a security update of Phonegap is released, Google Play requires you to upgrade your app. If you have written many apps (like I did), having to recreate all of them (3 times in latest 2 years) is quite annoying. Therefore I would recommend Webview instead.

source - http://stackoverflow.com/a/35298876


Fire up eclipse, API16, do the trick via webview (template source with example, support HTML5 dbase CRUD) : https://pipiscrew.com/Downloads/pipiscrew_webview.rar

special thanks to : https://gist.github.com/andyj/1599544 http://kylewbanks.com/blog/HTML5-Database-In-Android http://stackoverflow.com/a/17345438/1320686 https://github.com/HubSpot/sortable/issues/39


Loading dynamic html and javascript from assets in a WebView

https://forums.xamarin.com/discussion/3467/loading-dynamic-html-and-javascript-from-assets-in-a-webview

NanoHTTPD server running inside android app to serve html/images

https://gist.github.com/dhavaln/ce02f5c8c980acf847df

HTML5 Database Test

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//source - https://gist.github.com/dhavaln/3058562 + https://gist.github.com/dhavaln/3064728
//database_test.html

var filename = "name";
var filepath = "path";
function insertInTable(name, path)
{
    var db = window.openDatabase('taukydb', '1.0', 'Tauky Database', 2000);
    db.transaction(populateDB, errorCB, successCB);
}
function populateDB(tx) {
	tx.executeSql('DROP TABLE IF EXISTS taukytb');
    tx.executeSql('CREATE TABLE IF NOT EXISTS taukytb (name TEXT UNIQUE, path TEXT, uploaded INTEGER)');
    tx.executeSql('INSERT INTO taukytb (name, path, uploaded) VALUES ("'+filename+'", "'+filepath+'", 0)');
}
// Transaction success callback
function successCB() {
    alert("Hurrey!!!");
    //this is just for testing
    var db = window.openDatabase("anotherdb", "1.0", "Cordova Demo", 1024 * 1);
    db.transaction(populateDB, errorCB, function(){});               
}
function queryDB(tx) {
    tx.executeSql('SELECT * FROM taukytb', [], querySuccess, errorCB);
}
function querySuccess(tx, results) {
    var len = results.rows.length;
    alert(len);
}
//Transaction error callback
function errorCB1(err) {            
    alert("Error 11111 processing SQL: "+err.code);
    //console.log("Error processing SQL: "+err.code);
}
// Transaction error callback
function errorCB(err) {
	console.log(err.message);
    //alert("Error processing SQL: "+err.code);
    //console.log("Error processing SQL: "+err.code);
}

	<button onclick="insertInTable()">Start</button>

origin - http://www.pipiscrew.com/?p=5301 android-phonegap

This post is licensed under CC BY 4.0 by the author.
Contents

Trending Tags