kopia lustrzana https://github.com/ge0rg/aprsdroid
send update broadcasts on service start/stop
rodzic
f3ae403f68
commit
adb5744407
|
@ -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]
|
||||
if (l != null)
|
||||
onLocationChanged(l)
|
||||
status.setText(i.getStringExtra(AprsService.PACKET))
|
||||
setupButtons(AprsService.running)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Ładowanie…
Reference in New Issue