From 3e3af324da076a68b47734d818ebb9e98df864de Mon Sep 17 00:00:00 2001 From: Georg Lukas Date: Mon, 4 Aug 2014 13:33:49 +0200 Subject: [PATCH] service: Implement new SERVICE_STOP intent for Tasker et.al. --- src/AprsService.scala | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/AprsService.scala b/src/AprsService.scala index 05d7c01..89b7cc1 100644 --- a/src/AprsService.scala +++ b/src/AprsService.scala @@ -16,6 +16,7 @@ object AprsService { val SERVICE = PACKAGE + ".SERVICE" val SERVICE_ONCE = PACKAGE + ".ONCE" val SERVICE_SEND_PACKET = PACKAGE + ".SEND_PACKET" + val SERVICE_STOP = PACKAGE + ".SERVICE_STOP" // broadcast actions val UPDATE = PACKAGE + ".UPDATE" // something added to the log val MESSAGE = PACKAGE + ".MESSAGE" // we received a message/ack @@ -74,6 +75,11 @@ class AprsService extends Service { } def handleStart(i : Intent) { + if (i.getAction() == SERVICE_STOP) { + if (running) + stopSelf() + return + } else if (i.getAction() == SERVICE_SEND_PACKET) { if (!running) { Log.d(TAG, "SEND_PACKET ignored, service not running.")