private void _serviceConnection_ServiceConnected(object sender, ServiceConnectedEventArgs e) { Console.WriteLine(nameof(_serviceConnection_ServiceConnected) + " MainActivity ServiceConnection Service Connected"); _lblServiceStatus.Text = "Connected"; _lblServiceConnectedTime.Text = string.Format("Connected @ {0}", DateTime.Now.ToString(@"hh\:mm tt")); string bTime = "Broadcast Time: {0} {1}"; if (Location_BroadCastTime > 59) //In case dynamic values { bTime = string.Format(bTime, Location_BroadCastTime, "Min"); } else { bTime = string.Format(bTime, Location_BroadCastTime, "Sec"); } _lblBroadcastTimeInterval.Text = bTime; //Service is connected and ready use. if (Location != null) { Location.LocationChanged += Location_LocationChanged; } }
private void _serviceConnection_ServiceDisconnected(object sender, ServiceConnectedEventArgs e) { if (Location != null) { Location.LocationChanged -= Location_LocationChanged; } Console.WriteLine(nameof(_serviceConnection_ServiceConnected) + " MainActivity ServiceConnection Service Disconnected"); }