public void ReadRecentText() { // Open user's sms inbox ICursor cursor = MainActivity.Instance.ContentResolver.Query(Android.Net.Uri.Parse("content://sms/inbox"), null, null, null); if (cursor.MoveToFirst()) // Let's get the data for the first message pointed to by cursor // (Should be the only message we need) { string sms_body = ""; string address = ""; for (int i = 0; i < cursor.ColumnCount; i++) { switch (cursor.GetColumnName(i)) { case "address": string number = cursor.GetString(i); string resolved_number = getContactbyPhoneNumber(number); if (resolved_number == number) { if (number.Length >= 10) { number = number.Substring(number.Length - 10); address = "(" + number.Substring(0, 3) + ") " + number.Substring(3, 3) + "-" + number.Substring(6, 4); } else { address = string.Join(" ", number.ToCharArray()); } } else { address = resolved_number; } break; case "body": sms_body = cursor.GetString(i); break; } } var readAloud = new TextToAudio("Message from: " + address + ". " + sms_body); } cursor.Close(); }
/// <summary> /// Reads the next direction in the list /// </summary> public async void ReadNextDirectionAsync() { string direction = await GetNextDirectionAsync(); var readAloud = new TextToAudio("Next direction is " + direction); }