async void cdDrive(object sender, System.EventArgs e) { System.Diagnostics.Debug.WriteLine(" Clicked send location Button"); try { cdCallAPI mycallAPI = new cdCallAPI(); Plugin.Geolocator.Abstractions.Position mypos = await mycallAPI.GetCurrentPosition(); string cPosLat = mypos.Latitude.ToString(); string cPosLong = mypos.Longitude.ToString(); String mailSubject = "Student " + plogaccount.FirstName + " " + plogaccount.LastName + " location details"; String mailBody = "Location of student " + plogaccount.FirstName + " " + plogaccount.LastName + " " + cPosLat + " " + cPosLong; var myresult = mycallAPI.cdSendEmail(mailSubject, plogaccount.Attr1, mailBody); System.Diagnostics.Debug.WriteLine(" Result is " + myresult.ToString()); Status.Text = "Sent location " + cPosLat + " " + cPosLong + " to " + plogaccount.Attr1 + " Successfully"; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(" Result is " + ex); await DisplayAlert("Failed to get data. Please try later.", "Failed to get data. Please try later.", "OK"); } }