void SayHelloToService_Click(object sender, EventArgs e) { if (serviceConnection.Messenger != null) { Message msg = Message.Obtain(null, Constants.SAY_HELLO_TO_TIMESTAMP_SERVICE); try { serviceConnection.Messenger.Send(msg); } catch (RemoteException ex) { Log.Error(TAG, ex, "There was a error trying to send the message."); } } else { Toast.MakeText(this, "Seems like we're not connected to the service - nobody around to say hello to.", ToastLength.Short).Show(); } }
void AskForTimestampButton_Click(object sender, System.EventArgs e) { if (!serviceConnection.IsConnected) { Log.Warn(TAG, "Not connected to the service, so can't ask for the timestamp."); return; } Message msg = Message.Obtain(null, Constants.GET_UTC_TIMESTAMP); msg.ReplyTo = activityMessenger; try { serviceConnection.Messenger.Send(msg); Log.Debug(TAG, "Requested the timestamp from the Service."); } catch (RemoteException ex) { Log.Error(TAG, ex, "There was a problem sending the message."); } }