altosdroid: Send current state to client on connect
authorMike Beattie <mike@ethernal.org>
Sun, 26 Aug 2012 11:30:45 +0000 (23:30 +1200)
committerMike Beattie <mike@ethernal.org>
Sun, 26 Aug 2012 11:30:45 +0000 (23:30 +1200)
Signed-off-by: Mike Beattie <mike@ethernal.org>
altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java

index a61a1eda6b620f7988c4636c6f57c7dbca8cc281..7cd233ab646528b5805b0875084409300f4fada6 100644 (file)
@@ -81,6 +81,11 @@ public class TelemetryService extends Service {
                        switch (msg.what) {
                        case MSG_REGISTER_CLIENT:
                                s.mClients.add(msg.replyTo);
+                               try {
+                                       msg.replyTo.send(Message.obtain(null, AltosDroid.MSG_STATE_CHANGE, s.state, -1));
+                               } catch (RemoteException e) {
+                                       s.mClients.remove(msg.replyTo);
+                               }
                                if (D) Log.d(TAG, "Client bound to service");
                                break;
                        case MSG_UNREGISTER_CLIENT: