diff --git a/assets/gap.js b/assets/gap.js index 973cb399..30236518 100644 --- a/assets/gap.js +++ b/assets/gap.js @@ -300,7 +300,13 @@ var Device = { clearWatch: function(filter) { window.DroidGap.notificationClearWatch(filter); } - } + }, + + http: { + get: function(url, file) { + window.DroidGap.httpGet(url, file); + } + } } function gotLocation(lat, lon) { diff --git a/assets/index.html b/assets/index.html index f10e7784..d069a134 100644 --- a/assets/index.html +++ b/assets/index.html @@ -102,6 +102,14 @@ function onReceiveSms(number, message) $('message').value = message; } +http = function(func) +{ + if (func == 'get') { + Device.http.get($('httpGetUrl').value, $('httpGetFile').value) + } +} + + addLoadEvent(initGap); @@ -123,6 +131,7 @@ addLoadEvent(initGap);
  • Play Sound
  • Photo...
  • Notification...
  • +
  • HTTP...
  • About
  • @@ -258,4 +267,26 @@ addLoadEvent(initGap); +
    +

    HTTP

    +

    Make sure your Android sdk sdcard is mounted!

    +
    + +
    +
    +
    + + +
    +
    +
    +
    + + +
    +
    +
    +
    diff --git a/bin/DroidGap.apk b/bin/DroidGap.apk index 1d748d5b..e7deffed 100644 Binary files a/bin/DroidGap.apk and b/bin/DroidGap.apk differ diff --git a/bin/classes.dex b/bin/classes.dex index 2033b46f..f89159ba 100644 Binary files a/bin/classes.dex and b/bin/classes.dex differ diff --git a/bin/com/nitobi/phonegap/PhoneGap.class b/bin/com/nitobi/phonegap/PhoneGap.class index de6ec807..52e39721 100644 Binary files a/bin/com/nitobi/phonegap/PhoneGap.class and b/bin/com/nitobi/phonegap/PhoneGap.class differ diff --git a/bin/resources.ap_ b/bin/resources.ap_ index 0950b435..b5044bb1 100644 Binary files a/bin/resources.ap_ and b/bin/resources.ap_ differ diff --git a/src/com/nitobi/phonegap/PhoneGap.java b/src/com/nitobi/phonegap/PhoneGap.java index 8b0f6d63..faccb4be 100644 --- a/src/com/nitobi/phonegap/PhoneGap.java +++ b/src/com/nitobi/phonegap/PhoneGap.java @@ -233,6 +233,16 @@ public class PhoneGap{ mCtx.unregisterReceiver(mSmsListener); } } - + + public void httpGet(String url, String file) + /** + * grabs a file from specified url and saves it to a name and location + * the base directory /sdcard is abstracted so that paths may be the same from one mobile OS to another + * TODO: JavaScript call backs and error handling + */ + { + HttpHandler http = new HttpHandler(); + http.get(url, file); + } }