我的最終目標是創建一個應用程序,該應用程序將向用戶輸入的電話號碼數據庫發送文本消息。然後,通過按下按鈕,他們可以自動響應他們正在駕駛的所有人,並且希望他們能夠在另一個時間回覆他們。自動消息響應也是可定製的。我爲視覺工作室使用Xamarin,並且正在努力使文本發送。如何使用按鈕發送直接短信
using Android.App;
using Android.Widget;
using Android.OS;
using System;
using Android.Telephony;
namespace DrivePhone_GeniusHourProject
{
[Activity(Label = "Drive Time!", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
EditText SMS = FindViewById<EditText>(Resource.Id.SMS_Message);
Button sendSMS = FindViewById<Button>(Resource.Id.Send_SMS);
string SMS_Text = SMS.ToString();
var smsTo = NSUrl.FromString();
SmsMessage();
smsTo = "815376377";
sendSMS.Click += (object sender, EventArgs e) =>
{
}
}
}
}
[SmsManger](https://developer.android.com/reference/android /telephony/SmsManager.html)?! –
我的問題是我會做SmsManager。然後沒有發送文本的選項。但在開發者網站上有一個名爲sendTextMessage()的公共方法;但是我不能在Visual Studio中使用它。 –