我想在紧急情况下自动发送短信或电子邮件,无需任何用户交互。
以下代码帮助我撰写短信或电子邮件,但需要用户点击发送按钮
private static void SendSms(string mobileNumber)
{
SmsComposeTask smsComposeTask = new SmsComposeTask();
smsComposeTask.To = mobileNumber;
smsComposeTask.Body = "Alert: Save me! My last location was -";
smsComposeTask.Show();
}
private static void SendEmail(string emailAddress)
{
EmailComposeTask emailComposeTask = new EmailComposeTask();
emailComposeTask.To = emailAddress;
emailComposeTask.Subject = "Alert: Save me!";
emailComposeTask.Body = "Please save me my last location was - ";
emailComposeTask.Show();
}
有没有什么方法可以让我通过用户点击动作来发送短信?