diff --git a/res/values/arrays.xml b/res/values/arrays.xml
new file mode 100644
index 0000000..ab35ef3
--- /dev/null
+++ b/res/values/arrays.xml
@@ -0,0 +1,13 @@
+
+
+
+ - UDP port 8080
+ - HTTP POST
+
+
+
+ - udp
+ - http
+
+
+
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0c48f30..0d8ef59 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -14,6 +14,9 @@
APRS-IS validation passcode
Enter the passcode for your call
Networking
+Connection Protocol
+Choose UDP (port 8080) or HTTP POST (URL)
+Choose the connection protocol
Server
APRS-IS server (port 8080) to send beacons
Enter the APRS-IS server hostname
diff --git a/src/de/duenndns/aprsdroid/AprsService.scala b/src/de/duenndns/aprsdroid/AprsService.scala
index 8af1132..eb74cb6 100644
--- a/src/de/duenndns/aprsdroid/AprsService.scala
+++ b/src/de/duenndns/aprsdroid/AprsService.scala
@@ -64,7 +64,10 @@ class AprsService extends Service with LocationListener {
i.putExtra(LOCATION, location)
val packet = AprsPacket.formatLoc(prefs.getString("callsign", null), location)
try {
- new AprsHttpPost(prefs).update(packet)
+ if (prefs.getString("conntype", "udp") == "udp")
+ new AprsUdp(prefs).update(packet)
+ else
+ new AprsHttpPost(prefs).update(packet)
i.putExtra(PACKET, packet)
} catch {
case e : Exception => i.putExtra(PACKET, e.getMessage())
diff --git a/src/de/duenndns/aprsdroid/AprsUdp.scala b/src/de/duenndns/aprsdroid/AprsUdp.scala
new file mode 100644
index 0000000..5869965
--- /dev/null
+++ b/src/de/duenndns/aprsdroid/AprsUdp.scala
@@ -0,0 +1,28 @@
+package de.duenndns.aprsdroid
+
+import _root_.android.content.SharedPreferences
+import _root_.android.location.Location
+import _root_.android.preference.PreferenceManager
+import _root_.android.util.Log
+import _root_.java.net.{InetAddress, DatagramSocket, DatagramPacket}
+
+class AprsUdp(prefs : SharedPreferences) extends AprsIsUploader(prefs) {
+ val TAG = "AprsUdp"
+ lazy val socket = new DatagramSocket()
+
+ def start() {
+ }
+
+ def update(packet : String) {
+ val login = "user " + prefs.getString("callsign", null) +
+ " pass " + prefs.getString("passcode", null) + " vers APRSdroid beta"
+ var hostname = prefs.getString("host", null)
+ val addr = InetAddress.getByName(hostname)
+ val pbytes = (login + "\r\n" + packet + "\r\n").getBytes()
+ socket.send(new DatagramPacket(pbytes, pbytes.length, addr, 8080))
+ Log.d(TAG, "update(): sent " + packet + " to " + hostname)
+ }
+
+ def stop() {
+ }
+}