send update broadcasts on service start/stop

remotes/nogy/update_90
Georg Lukas 2010-01-07 18:25:26 +01:00
rodzic f3ae403f68
commit adb5744407
2 zmienionych plików z 5 dodań i 1 usunięć

Wyświetl plik

@ -28,8 +28,10 @@ class APRSdroid extends Activity with LocationListener with OnClickListener {
lazy val locReceiver = new BroadcastReceiver() {
override def onReceive(ctx : Context, i : Intent) {
val l = i.getParcelableExtra(AprsService.LOCATION).asInstanceOf[Location]
onLocationChanged(l)
if (l != null)
onLocationChanged(l)
status.setText(i.getStringExtra(AprsService.PACKET))
setupButtons(AprsService.running)
}
}

Wyświetl plik

@ -41,6 +41,7 @@ class AprsService extends Service with LocationListener {
singleShot = true
}
showToast("Service started: " + i.getAction)
sendBroadcast(new Intent(UPDATE).putExtra(PACKET, "started"))
}
override def onBind(i : Intent) : IBinder = null
@ -55,6 +56,7 @@ class AprsService extends Service with LocationListener {
showToast("APRS Service stopped.")
locMan.removeUpdates(this);
running = false
sendBroadcast(new Intent(UPDATE).putExtra(PACKET, "shutdown."))
}
// LocationListener interface